<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!

  • 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!

  • +1 in reply to Gerald Cruz
    verified answer

    That is a method that has probably been around since reports were taken to framework. 

    If the method is failing, you need to find out why, try either writing to a log or if possible, display a message box containing the oJournalUpdate.sLastErrorNum and oJournalUpdate.sLastErrorMsg properties.

    Since you mentioned 2018, it is possible that you do not have the copy of ..\MAS90\Home\pvxwin32.exe.config copied and renamed to pvxcom.exe.config in the C:\Program Files (x86)\Common Files\Sage\CommonComponents folder?

    See this post.

    https://www.sagecity.com/support_communities/sage100_erp/f/sage-100-business-object-interface/78293/export-report-using-boi/320950#320950 

  • 0 in reply to David Speck

    Hi David,

    That seem to have fixed our problem! 

    Thank you so much!