I know I can create a field in the SO detail and total it in the header, but they have hundreds of existing orders and we are changing the calculation which would then go to zero. I have it on the SalesOrderHeader Table Pre-totals.
So I want to read all the detail lines and put the total in the Header.
I get an error 88 on oHeaderObj SO_SaleasOrderHistory.pvc
itemtype= ""
TotUnits =0
Set oLines = oBusObj.AsObject(oBusObj.Lines)
retVal = oLines.MoveFirst()
Do until oLines.EOF
retval = oLines.GetValue("ItemType$", itemtype)
if itemtype = "1" then
retval = oLines.GetValue("UDF_PALLET_COUNT_UNITS",punits)
retval = oLines.GetValue("UDF_PALLET_WEIGHT",pwgt)
if pwgt = 0 then
Totwgt = Totwgt + (punits * 75)
else
Totwgt = Totwgt + (punits * pwgt)
End if
TotUnits = TotUnits + punits
End if
retval = oLines.MoveNEXT()
Loop
retval=oHeaderObj.SetValue("UDF_PALLET_WEIGHT LBS",Totwgt)
retval=oHeaderObj.SetValue("UDF_TOTAL_PALLETS_UNITS",TotUnits)
Thank you in advance.