AutoGenerate from Sales Orders Does Not Copy Item Comments from DropShip Lines

Hello,

We have comments on sales order dropship lines that we would like copied to automatically generated purchase orders, if possible.  We are unsure how to accomplish this.  Is it possible to transfer sales order line item comments to dropship purchase orders using the AutoGenerate from Sales Orders task in Purchase Order?  If not, is scripting a better option for this task?  I have done very limited scripting so far, but I am looking to take the Sage Data Files and Business Objects courses to learn more about it.

Thank you for your help,

Brian

  • 0

    I think you would have to use scripting, you can use this script from a previous question I had posted.  I think you would just insert your tables and maybe a few more adjustments.

    This one I am going from the ROG to write to the SO

     Troubleshooting Loop in SODetail 

    This script I am taking the values from the PO to write to the SO, so reverse this thought process, not sure on what you could trigger off of though.

    'Script to transfer notes made on PO to SO in UDF field
    
    Dim sPurchaseOrderNo
    Dim sSalesOrderNo
    Dim sItemCode
    Dim sItemCodeCur
    Dim sPO_Notes
    Dim sSO_Notes
    Dim sOrderStatus
    Dim oSalesOrder
    
    sPurchaseOrderNo = ""
    sSalesOrderNo = ""
    sItemCode = ""
    sItemCodeCur = ""
    sPO_Notes = ""
    sSO_Notes = ""
    sOrderStatus = ""
    sPOSOLines = ""
    oSalesOrder = 0
    
    retVal = oBusObj.GetValue("SalesOrderNo$",sSalesOrderNo)
    r=oScript.DebugPrint("SalesOrderNo: " & sSalesOrderNo)
    
    if sSalesOrderNo <> "" then
    
    	retVal = oBusObj.GetValue("ItemCode$",sItemCode)
    	retVal = oBusObj.GetValue("UDF_PURCHASING_NOTES$", sPO_Notes)
    	retVal = oBusObj.GetValue("UDF_SOLINE$",sPOSOLines)
    
    	r=oScript.DebugPrint("ItemCode: " & sItemCode)
    	r=oScript.DebugPrint("Notes: " & sPO_Notes)
    	r=oScript.DebugPrint("POSOLines: " & sPOSOLines)
    	if sPO_Notes <> "" then
    
    		sSO_Notes = sPO_Notes
    		
    		oSalesOrder = oSession.GetObject("SO_SalesOrder_bus")
    		r=oScript.DebugPrint("After oSession.GetObj")
    
    		if oSalesOrder <> 0 then
    
    			Set oSalesOrder = oSession.AsObject(oSalesOrder)
    			r=oScript.DebugPrint("After AsObject for oSalesOrder")
    
    			retVal = oSalesOrder.SetKeyValue("SalesOrderNo$", sSalesOrderNo)
    			retVal = oSalesOrder.SetKey()
    
    			if retVal = 1 Then
    			
    				r=oScript.DebugPrint("After Successful SO SetKey ")
    
    				retVal = oSalesOrder.GetValue("OrderStatus$",sOrderStatus)
    				r=oScript.DebugPrint("OrderStatus: " & sOrderStatus)
    
    	
    				Set oSOLine = oSalesOrder.AsObject(oSalesOrder.Lines)
    '				retVal = oSOLine.SetKeyValue("SalesOrderNo$", sSalesOrderNo)
    '				retVal = oSOLine.SetKeyValue("LineKey$", sSOLines)
    '				retVal = oSOLine.SetKey()
    
    				r=oScript.DebugPrint("After AsObject oSOLines ")
    
    				retVal = oSOLine.MoveFirst()
    				r=oScript.DebugPrint("After MoveFirst ")
    				sLineSONo=""
    				sSOLinesKey = ""
    				retVal = oSOLine.GetValue("SalesOrderNo$",sLineSONo)
    				r=oScript.DebugPrint("Lines SO Num " & sLineSONo)
    
    
    				lineUpdated = 0 ' initialize new indicator
    
    				do until (oSOLine.Eof or lineUpdated=1)
    
    					retVal = oSOLine.GetValue("ItemCode$",sItemCodeCur)
    					retVal = oSOLine.GetValue("LineKey$",sSOLinesKey)
    					r=oScript.DebugPrint("CurrentItemCode: " & sItemCodeCur)
    					r=oScript.DebugPrint("CurrentItemCode: " & sItemCodeCur)
    																							
    					if sItemCode = sItemCodeCur AND (sOrderStatus = "N" Or sOrderStatus ="O") And sSOLinesKey = sPOSOLines Then
    
    						retVal = oSOLine.SetValue("UDF_PURCHASING_NOTES$",sSO_Notes)
    						retVal = oSOLine.Write()
    						lineUpdated = 1 'trip flag
    						r=oScript.DebugPrint("retVal on oSOLine Write: " & CStr(retVal))
    						r=oScript.DebugPrint("lineUpdated = " & CStr(lineUpdated))
    											
    					end if
    					retVal = oSOLine.MoveNext()
    				loop
    							
    				if lineUpdated=1 then ' only write if we found a match
    								
    					retVal = oSalesOrder.Write()
    					r=oScript.DebugPrint("retVal on oSalesOrder Write: " & CStr(retVal))
    
    				end if
    
    				retVal = oSOLine.MoveNext()									
    						
    			end If
    		End If
    	end if
    
    end if