Hi Forum,
Is there a way to update the Comment$ column in GL_CompanyActiveBatch table using BOI?
The following is the code I am working with ...
'********************** Instantiate Objects ************************
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_Shipping_UI"))
Set oShip = oScript.NewObject("SO_Shipping_bus", oSS)
'On Error Resume Next
retVal = oSS.nSetProgram(oSS.nLookupTask("GL_CompanyActiveBatch_ui"))
set oGLBatch = oScript.NewObject("GL_CompanyActiveBatch_svc", oSS)
'On Error GoTo 0
'********************** Set Active Batch ************************
sBatchNo = ""
retVal = oGLBatch.nSetKeyValue("ModuleCode$", "S/O")
retVal = oGLBatch.nSetKeyValue("BatchType$", "01")
retVal = oGLBatch.nSetKeyValue("BatchNo$", "21PAR")
retVal = oGLBatch.nFind()
if retVal <> 1 then
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Error: Cannot Find Batch ")
end if
retVal = oGLBatch.nGetValue("BatchNo$", nBatch)
retVal = oGLBatch.nGetValue("Comment$", sComm)
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Batch " & nBatch & " : " & sComm)
retVal = oGLBatch.nMoveNext()
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Editable State " & retVal)
retVal = oGLBatch.nSetValue("Comment$", "Test") ===> Here is the line of the error..
Any suggestions?
The following is the code I am working with ...
'********************** Instantiate Objects ************************
retVal = oSS.nSetProgram(oSS.nLookupTask("SO_Shipping_UI"))
Set oShip = oScript.NewObject("SO_Shipping_bus", oSS)
'On Error Resume Next
retVal = oSS.nSetProgram(oSS.nLookupTask("GL_CompanyActiveBatch_ui"))
set oGLBatch = oScript.NewObject("GL_CompanyActiveBatch_svc", oSS)
'On Error GoTo 0
'********************** Set Active Batch ************************
sBatchNo = ""
retVal = oGLBatch.nSetKeyValue("ModuleCode$", "S/O")
retVal = oGLBatch.nSetKeyValue("BatchType$", "01")
retVal = oGLBatch.nSetKeyValue("BatchNo$", "21PAR")
retVal = oGLBatch.nFind()
if retVal <> 1 then
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Error: Cannot Find Batch ")
end if
retVal = oGLBatch.nGetValue("BatchNo$", nBatch)
retVal = oGLBatch.nGetValue("Comment$", sComm)
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Batch " & nBatch & " : " & sComm)
retVal = oGLBatch.nMoveNext()
MsgBox(oGLBatch.sLastErrorMsg & vbCRLF & "Editable State " & retVal)
retVal = oGLBatch.nSetValue("Comment$", "Test") ===> Here is the line of the error..
Any suggestions?
Greetings,
Service objects (like GL_CompanyActiveBatch_svc) are read only so the error makes sense. You cannot use service objects to modify or create records.
Try using SY_BatchManager_bus to create or edit records in GL_CompanyActiveBatch.
Thank you,
Kent
Thanks Kent, will give it a try...
Regards
Thanks, that worked fine ...
Regards,
*Community Hub is the new name for Sage City