Updating Batches via BOI

SOLVED

Hello all!

I'm working on a script to auto approve batches but I am running into some issues.  I looked through the BOI course and there is an example in there that updates the SalesOrder so I adapted my code from that.  I'm not sure if I'm setting it to the right module or not.  I'm a little confused on if I should be updating the Receipt Register or the GL.

We run SAGE 100 MAS 90.

Below is the code I currently have. 

oGLPost=""
Set oScript = CreateObject("ProvideX.Script")
oScript.Init("C:\sage\Sage 100 Advanced\MAS90\Home")
Set oSS = oScript.NewObject("SY_Session")

retVal = oSS.nLogon()
If retVal = 0 then 
    retVal = oss.nSetUser("user","password")
End If

retVal = oss.nSetCompany("TST")
retVal = oSS.nSetDate("P/O""20200715")
retVal = oSS.nSetModule("P/O")

oGLUI = oSS.nSetProgram(oSS.nLookUpTask("PO_ReceiptRegister_UI"))

WScript.Echo oSS.sLastErrorMsg & "Line 17 PO UPDATE UI set"
Set oGLPost = oScript.NewObject("PO_ReceiptRegister_upd", oSS)

WScript.Echo "Line 20 PO UPD set"

' WScript.Echo "oGLPost set to new object"

If retVal = 0 Then 
  WScript.Echo oSS.sLastErrorMsg
    'MessageBox.Show(oSS.sLastErrorMsg)
End If 

retVal = oGLPost.nSelectBatch("07864")
WScript.Echo "Batch number set"
 
If CBool(oGLPost.nProcessReport("DEFERRED")) Then
   retVal = oGLPost.nUpdate()
   Select Case retVal 
     Case 0 
     WScript.Echo oGLPost.sLastErrorMsg
       'MessageBox.Show(oGLPost.sLastErrorMsg)
     Case 1 
       'MessageBox.Show("GL Updated Successfully!")
       WScript.Echo "GL Updated Successfully!"
   End Select
Else
  'MessageBox.Show(oGLPost.sLastErrorMsg)
  WScript.Echo oGLPost.sLastErrorMsg & "nProcessReport Else Statement Fired!"
End If

oGLPost.DropObject()
Any help pointing me in the right direction is greatly appreciated!
Parents Reply
  • 0 in reply to David Speck

    Thank you for the clarification David.  I feel like a lot of the mystery surrounding SAGE (at least for me) has to do with the vocabulary.  When I see the word print I assume physical printing.  But after your explanation I know think I understand it as printing to the Deferred printing log or to the Paperless Office. 

    Are those the only 2 destinations possible? 

    I'll have to get more info from stakeholders but as far as I know they just want the batches to "auto approve" based on certain criteria.  This approval is the same as printing to Deferred or Paperless?

    Thank you again for all of the awesome information and all of your help!

Children