Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
dosborn
Posts: 25
Registered: 12-15-2011
0
Accepted Solution

Get Product Line for Item on Sales Order

So I am currently looping through the Line Items on a sales order when the sales order is saved, but I can't seem to figure out how to grab the Product Line for the Line Item.

 

itemCode = ""
itemCodeDesc = ""

Set oLines = oBusObj.AsObject(oBusObj.Lines)
oLines.MoveFirst

While Not(cBool(oLines.EOF))
   rtnVal = oLines.GetValue("ItemCode$", itemCode)
   rtnVal = oLines.GetValue("ItemCodeDesc$", itemCodeDesc)
   oLines.MoveNext
Wend

 

Regular Contributor
Gator
Posts: 272
Registered: 12-05-2008
0

Re: Get Product Line for Item on Sales Order

[ Edited ]

This would be put before your MoveNext.

 

prodLine = ""

set oItem = oLines.AsObject( oLines.GetChildHandle("ItemCode"))

oItem.Find(itemCode)

oItem.GetValue("ProductLine$",prodLine

Regular Contributor
Gator
Posts: 272
Registered: 12-05-2008

Re: Get Product Line for Item on Sales Order

Here is a more complete code:

 

itemCode = ""
itemCodeDesc = ""
itemType = ""
prodLine = ""
oLines = 0
oItem = 0

Set oLines = oBusObj.AsObject(oBusObj.Lines)
Set oItem = oLines.AsObject(oLines.GetChildHandle("ItemCode"))
oLines.MoveFirst

While Not(cBool(oLines.EOF))
   rtnVal = oLines.GetValue("ItemCode$", itemCode)
   rtnVal = oLines.GetValue("ItemCodeDesc$", itemCodeDesc)
   rtnVal = oLines.GetValue("ItemType$",itemType)
   if itemType = "1" then
      rtnVal = oItem.Find(itemCode)
      rtnVal = oItem.GetValue("ProductLine$",prodLine)
   end if
   oLines.MoveNext
Wend