Hello all! First post so I'm pretty new to this. My first foray into BOI programming is trying to create a warehouse transfer from one warehouse to another. It looks like the process completes without errors and that when I look at the Quantity in Item Inquiry it appears that the warehouse has changed. When I look in DFDM at the table im_itemcost, it appears that nothing has changed, thus preventing further transfers. What would cause this? Any help greatly appreciated! Code posed below:
' Error Checker
Sub retChk(ret, sender)
If ret = 0 Then
wscript.echo(sender.s_CLASS & " : " & sender.sLastErrorMsg)
End If
End Sub
' Initialize Script
Set oPVX = CreateObject("ProvideX.Script")
oPVX.Init("C:\ACCT\MAS90\Home")
Set oSS = oPVX.NewObject("SY_Session")
retVAL = oSS2.nSetUser("***","*********")
retVal = oSS.nSetCompany("NES")
retVAL = oSS.nSetDate("I/M", "20160203")
retVAL = oSS.nSetModule("I/M")
' Start Transaction Entry
oSS.nSetProgram(oSS.nLookupTask("IM_Transaction_ui"))
Set oIMTransaction = oPVX.NewObject("IM_Transaction_bus", oSS)
' Create Transfer and set values
retVal = oIMTransaction.nSetValue("TransactionType$","4")
strEntryNo = ""
retVal = oIMTransaction.nGetNextEntryNo(strEntryNo)
retVal = oIMTransaction.nSetKeyValue("EntryNo$", strEntryNo)
retVal = oIMTransaction.nSetKey("4" & strEntryNo)
' Set values for Transfer
retVal = oIMTransaction.nSetValue("TransactionDate$","20160203")
retVal = oIMTransaction.nSetValue("DefaultFromWhseCode$", "O51")
retVal = oIMTransaction.nSetValue("ToWhseCode$", "RNT")
retVal = oIMTransaction.nSetValue("Comment$", "Warehouse Transfer")
' Add and set values for Lines
retVal = oIMTransaction.oLines.nAddLine()
retVal = oIMTransaction.oLines.nSetValue("ItemCode$", "A0110523")
retVal = oIMTransaction.oLines.nSetValue("TransactionQty", 1.00000)
' Distribute item
retChk oIMTransaction.oLines.oDistribution.nAddDistributionLine("52661"), oIMTransaction.oLines.oDistribution
retChk oIMTransaction.oLines.oDistribution.nSetValue("TransactionQty", 1), oIMTransaction.oLines.oDistribution
' Commit changes in correct order - Distribute, lines, transaction
retChk oIMTransaction.oLines.oDistribution.nWrite(), oIMTransaction.oLines.oDistribution
retChk oIMTransaction.oLines.nWrite(), oIMTransaction.oLines
retChk oIMTransaction.nWrite(), oIMTransaction.oLines.oDistribution
' Clean up
oIMTransaction.DropObject()
oSS.Dropobject()
Set oIMTransaction = Nothing
set oSS = Nothing
Set oPVX = Nothing
' Step 2: Transaction Register
' Create new Session for Transaction Register
Set oPVX2 = CreateObject("ProvideX.Script")
oPVX2.Init("C:\ACCT\MAS90\Home")
Set oSS2 = oPVX2.NewObject("SY_Session")
retVAL = oSS2.nSetUser("***","*********")
retVal = oSS2.nSetCompany("NES")
retVAL = oSS2.nSetDate("I/M", "20160203")
retVAL = oSS2.nSetModule("I/M")
' Create Transaction Register instance
oSS2.nSetProgram(oSS2.nLookupTask("IM_TransactionRegister_ui"))
Set oIMTransEntry = oPVX2.NewObject("IM_TransactionRegister_upd", oSS2)
oSS2.nTerminateUI()
' Perform updates
retVal = oIMTransEntry.nUpdateInit()
retVal = oIMTransEntry.nUpdateMain()
retVal = oIMTransEntry.nUpdateCleanup()
' Clean up script
oIMTransEntry.DropObject()
oSS2.Dropobject()
Set oIMTransEntry = Nothing
set oSS2 = Nothing
Set oPVX2 = Nothing
' Show message stating script complete
MsgBox("Done")