Hi Forum, I am trying to use a button to update SO Lines in Sage 100 2013. The loop works but it doesn't update the lines UDF. Here is the code. ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' Process 1: Update Customer PO * ' Number to all Items * ' * ' K-4 Systems, LLC. Mroman * ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * strItemCode = "" : oLines = 0 : SoItemCode = "": soUDFCustPO = "": SoItemType = "": SoSONum = "": SoSONumLine = "" lineUpdated = 0 retVal = oBusObj.GetValue("CustomerPONo$", soUDFCustPO) retVal = oBusObj.GetValue("SalesOrderNo$", SoSONum) Set oSoItem = oSession.AsObject(oSession.GetObject("SO_SalesOrder_BUS")) strMsg = "Customer PO No return code: " & retVal & " PO Number Found: " & soUDFCustPO retVal = oSession.AsObject(oSession.UI).MessageBox("",strMsg) Set oSoDetail = oSession.AsObject(oSoItem.Lines) lineUpdated = 0 retVal = oSoDetail.Find(SoSONum) retVal = oSoDetail.MoveNext() retVal = oSoDetail.GetValue("SalesOrderNo$", SoSONumLine) While Not(CBool(oSoDetail.EOF)) and SoSONum = SoSONumLine SoItemCode = "" 'retVal = oSoDetail.GetValue("SalesOrderNo$", SoSONumLine) retVal = oSoDetail.GetValue("ItemCode$", SoItemCode) retVal = oSoDetail.GetValue("ItemType$", SoItemType) If SoItemType "4" then strMsg = "Item Number return code: " & retVal & " Item Number Found: " & SoItemCode & " S/O Number: " & SoSONumLine & " PO Number: " & soUDFCustPO retVal = oSession.AsObject(oSession.UI).MessageBox("",strMsg) retVal = oSoDetail.SetValue("UDF_CUSTOMER_PO$", soUDFCustPO) retVal = oSoDetail.Write() msgBox "retVal " & retVal End If retVal = oSoDetail.MoveNext retVal = oSoDetail.GetValue("SalesOrderNo$", SoSONumLine) Wend Set oSoDetail = nothing Can someone tell me what am i doing wrong?.. Regards, Manuel Roman
↧