Skip to Content
Jul 10, 2020 at 01:14 PM

DIAPI Sales Order change item wit sales bom

379 Views Last edit Jul 10, 2020 at 01:46 PM 2 rev


i have some questions regarding item changing in sales order lines through diapi.
I have an item with treetype "Assembly" in OITT inside of my salesorder line (RDR1).

For some reasons i have to change the treetype of this item (OITT) to treetype "Sales".
Therefore i have to change the itemcode in the salesorderline (RDR1) to another item,
change the treetype in OITT to "sales" and rechange the item in RDR1 to the old item.

Inside of SAP B1 GUI everything works fine and the mask reloads the sales BOM into the Lines.

If i try to do this with diapi it will not reload the lines correctly.

Does anyone have an idea how to handle this?

Here is some samplecode

'get SalesOrder
RetVal = vOrder.GetByKey("602")

' change item in ordeline
vOrder.Lines.ItemCode = "000208"
RetVal = vOrder.Update()

'get Item BOM 'change treetype of item from assembly to sales
vProdTree.TreeType = SAPbobsCOM.BoItemTreeTypes.iSalesTree

'rechange item in orderline
vOrder.Lines.ItemCode = ("000208_TS")
RetVal = vOrder.Update()

The orderlines remain with the item and the old status Assembly in treetype.

Thank you for your help.

Kind regards



before changing

After changing with GUI

After changing with DIAPI


gui-change.png (10.5 kB)
before.png (8.7 kB)
after-diapi.png (8.6 kB)