Showing results for 
Search instead for 
Did you mean: 

DIAPI Sales Order change item wit sales bom

0 Kudos


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

Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear marc.ottmueller,

What if you remove the line first and add the Item again? Does it work for you in that case?

Kind regards,


SAP Business One Support

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hello Aknit Chauhan,

thank you for your answer.

If i delete the line first and add a new line it works correct. But the line will be added at the end of the order. If the order has more than one item / line the visible order would be different.

Therefore i can not delete and add. Do you have any other tips for me?

Kind regards