<Error: 0 in Method UPDATEINT>

SOLVED

Hi, 

I have the code below for automatic registration/update of the production transactions.

I've been getting an error on the UpdateInit method.

oSS2.nSetProgram(oSS2.nLookupTask("BM_ProductionRegister_UI"))
                    objTransactionRegister = oScript2.NewObject("BM_ProductionRegister_UPD", oSS2)
                    oSS2.nTerminateUI()
                    If blnUseBatch = True Then
                      retVal = objTransactionRegister.nSelectBatch(strBatchNo)
                    End If
                    retVal = objTransactionRegister.nProcessReport("DEFERRED")
                    retVal = objTransactionRegister.nUpdateInit()
                    retVal = objTransactionRegister.nUpdate()
                    retVal = objTransactionRegister.nUpdateMain()
                    retVal = objTransactionRegister.nUpdateCleanup()
                   
                    'drop the Transaction Register
                    objTransactionRegister.DropObject()
                    'drop the session
                    oSS2.DropObject()

error is as follows "<Error: 0 in Method UpdateINIT>

Any help will be greatly appreciated.

Thanks!

Parents
  • 0
    SUGGESTED

    In a script set up to use paperless office and for a different register object, i used the following.

    Set oSecurity = oSage100SessionObj.oSetProgram(oSage100SessionObj.nLookupTask("IM_StandardCostAdjustReg_ui"))
    nIM_StdCostAdj_UpdObj = oSage100SessionObj.nGetObject("IM_StandardCostAdjustReg_upd")
    If nIM_StdCostAdj_UpdObj > 0 Then
    	Set oIM_StdCostAdj_UpdObj = oSage100SessionObj.oGetObject("IM_StandardCostAdjustReg_upd")
    	oIM_StdCostAdj_UpdObj.nPDFSilent = 1
    	' nRetVal = 0 : nRetVal = oIM_StdCostAdj_UpdObj.nValidatePrinter("Printer Output")
    	nRetVal = 0 : nRetVal = oIM_StdCostAdj_UpdObj.nSetPostingDate(oSage100SessionObj.sSystemDate)
    	subWriteToLog("Time Stamp: " & Now() & vbTab & "Company Code: " & sCompanyCode & vbTab & "Set Posting Date: " & oSage100SessionObj.sSystemDate & vbTab & "Return Value: " & nRetVal & vbTab & "Last Error Msg: " & oIM_StdCostAdj_UpdObj.sLastErrorMsg)
    	nRetVal = 0 : nRetVal = oIM_StdCostAdj_UpdObj.nProcessReport("Print")
    	subWriteToLog("Time Stamp: " & Now() & vbTab & "Company Code: " & sCompanyCode & vbTab & "Processing Report: " & "IM Std Cost Adj Reg" & vbTab & "Return Value: " & nRetVal & vbTab & "Last Error Msg: " & oIM_StdCostAdj_UpdObj.sLastErrorMsg)
    	If nRetVal = 1 Then 
    		nRetVal = 0 : nRetVal = oIM_StdCostAdj_UpdObj.nEndOfPDFConverterJob()
    		nRetVal = 0 : nRetVal = oIM_StdCostAdj_UpdObj.nUpdate()
    		subWriteToLog("Time Stamp: " & Now() & vbTab & "Company Code: " & sCompanyCode & vbTab & "Updating: " & "IM Std Cost Adj Reg" & vbTab & "Return Value: " & nRetVal & vbTab & "Last Error Msg: " & oIM_StdCostAdj_UpdObj.sLastErrorMsg)
    		nFunctionUpdateIM_StdCostAdjReg = nRetVal
    	End If
    	Set oIM_StdCostAdj_UpdObj = Nothing
    	oSage100SessionObj.nDropObject nIM_StdCostAdj_UpdObj
    Else
    	subWriteToLog("Time Stamp: " & Now() & vbTab & "Company Code: " & sCompanyCode & vbTab & "Getting Object Handle Failed For: " & "IM_StandardCostAdjustReg_upd" & vbTab & "Return Value: " & "" & vbTab & "Last Error Msg: " & oSage100SessionObj.sLastErrorMsg)
    End If

    In another script for the PO receipt register, i used the following methods in this order to export to PDF.

    retValBatch = oJournalUpdate.nSelectBatch(sBatch)
    retVal = oJournalUpdate.nSetPostingDate(sTransDate)
    retval = oJournalUpdate.nInitReportEngine()
    oJournalUpdate.nReportType = 6
    retval = oJournalUpdate.nSetExportOptions(5, sOutputPath)
    retValExport = oJournalUpdate.nProcessReport("EXPORT")
    retValUpdateInit = oJournalUpdate.nUpdateInit()
    retValUpdateMain = oJournalUpdate.nUpdateMain()
    retValCleanUp = oJournalUpdate.nUpdateCleanUp()

    Some registers are simpler and only need nUpdate() called after the report has been processed, others, like the PO receipt register needed nUpdateInit(), nUpdateMain(), and nUpdateCleanUp()

  • +1 in reply to David Speck
    verified answer

    Hi David, 


    Figured out the issue, it seems to be that nProcessReport() immediatly returns "nothing" instead of "1,0,-1" when we use Sage100 2018.

    however if we run it on sage100 2020. it would run as it supposed to be.

    is it a case of not yet being supported/implemented on 2018 version?

    Thanks!

Reply
  • +1 in reply to David Speck
    verified answer

    Hi David, 


    Figured out the issue, it seems to be that nProcessReport() immediatly returns "nothing" instead of "1,0,-1" when we use Sage100 2018.

    however if we run it on sage100 2020. it would run as it supposed to be.

    is it a case of not yet being supported/implemented on 2018 version?

    Thanks!

Children