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 js-goose
    SUGGESTED

    Is batching enabled for PO Receipts?

    Usually, you'll want to check the nBatchEnabled property, if 1, it is enabled and you should use nSelectBatch, if 0, it is not enabled and you should not use nSelectBatch.

    Check if paperless office is set up for the PO journals/registers specifically or for all journals/registers for the target company, if it is enabled, you will need to copy the [Paperless] section from MAS90\Launcher\SOTA.ini to all instances of the PVX.ini file which should be found in MAS90\Home

Children