Hi Everyone,
I’m working on a script to default the landed cost in ROG entry and I’m not having any luck with setting the values. Please be aware that this is my first attempt at creating a script like this. I have successfully created simple scripts within the same business object so I am still learning. I am working in a Sage 100 Advanced 2014 environment. The Sage 100 user login has full administrator rights to all modules.
Scope:
In PO ROG, once you select accept to accept the ROG I would like to write the Landed cost type and the dollar amount. UDF fields are created in the PO ROG lines and on the header that totals up the total Lanced cost.
Here is the script. When I run the script I get the following error:
C:\Sage\.....\MAS90\MAS_ABC\POABC\PO_LandedCostReceipt.m4t does not have the correct permissions.
Dim sReceiptType
Dim sReceiptNo
Dim nTotalLC
Dim sLCType
Dim oLCReceipt
sReceiptType = "G"
sReceiptNo = ""
nTotalLC = 0
sLCType = "VOLM"
retVal=oBusObj.GetValue("ReceiptType$",sReceiptType)
if sReceiptType="G" then
retVal=oBusObj.GetValue("ReceiptNo$",sReceiptNo)
retVal=oBusObj.GetValue("UDF_PO_Total_Landed_Cost",nTotalLC)
end if
oLCReceipt=oSession.GetObject("PO_LandedCostReceipt_bus")
if oLCReceipt<>0 then
Set oLCReceipt=oSession.AsObject(oLCReceipt)
end if
retVal=oLCReceipt.SetKey(sReceiptType & sReceiptNo & sLCType)
if retVal<>0 then
retVal=oLCReceipt.setValue("ReceiptType$",sReceiptType)
retVal=oLCReceipt.setValue("ReceiptNo$",sReceiptNo)
retVal=oLCReceipt.setValue("LandedCostType$",sLCType)
retVal=oLCReceipt.setValue("LAndedCostAmount",nTotalLC)
retVal=oLCReceipt.Write()
end if
If I modify the following in the script I receive a new error message:
Change the setKey to SetKeyValue in the line below I will get the following error message:
Error88 – Wrong number of arguments or invalid property assignment oLCReceipt.SetKeyValue
retVal=oLCReceipt.SetKey(sReceiptType & sReceiptNo & sLCType)
I am not sure if this can be done or not. If I can default the landed cost information then please review my script and advise the changes. Thank you for your time.