Sage 100

 View Only
  • 1.  Production Management Script

    Posted 01-08-2025 10:33

    Good Morning! Does anyone have a script that successfully accesses a work ticket and then the lines associated with that work ticket? I have a client that uses ScanForce's Make to Order enhancement which gives us a link between SO and PM. This script happily opens the WT Header table and will update header fields but trying to open the lines associated with the work ticket is crashing out on me with an error 88 that half prints on the screen so I can't see the full error message. Can anyone see what I'm doing wrong?  Thank you!

    'dim variables
    WTNum = "" :  PromiseDate = "" :
    
    'get values from SO Sales Order Detail
    
    retVal = oBusObj.GetValue("PromiseDate$", PromiseDate)
    retVal = oBusObj.GetValue("SO519_WorkTicketNo$", WTNum)
    
    'only if WT number is populated
    if WTNum <> "" then
    	'open Work Ticket Object
    	oWT2 = oSession.GetObject("PM_WorkTicket_Bus")
    	if oWT2 <> 0 then
    		set oWT2 = oSession.AsObject(oWT2)
    			retD = oScript.DebugPrint("WT Object Open")
    		retVal = oWT2.SetIndex("KWORKTICKETNO")
    		retVal = oWT2.SetKeyValue("WorkTicketNo$", WTNum)
    		retVal = oWT2.SetKey()
    			retD = oScript.DebugPrint("WT found? " & retVal)
    
    		set oWTLines = oWT2.AsObject(oWT2.Lines)
    			retVal = oWTLines.MoveFirst()
    			Do until oWTLines.EOF
    				retVal = oWTLines.SetValue("PromiseDate$", PromiseDate)
    				retVal = oWTLines.Write()
    			retVal = oWTLines.MoveNext()
    			Loop
    	end if ' WT rights
    
    retVal = oSession.DropObject("PM_WorkTicket_Bus")
    
    end if 'WT number populated

    This is what the error looks like in case it helps:



    ------------------------------
    Kate Krueger
    Consultant
    MicroAccounting
    214.800.5555x553
    ------------------------------


  • 2.  RE: Production Management Script

    Posted 01-08-2025 18:49

    okay - I think I managed to solve this. I was missing the write for the WT header object. I added "retVal = oWT2.Write()" after the Loop of oWTLines and now it seems happy. On to the next battle!



    ------------------------------
    Kate Krueger
    Consultant
    MicroAccounting
    214.800.5555x553
    ------------------------------