Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to insert sales order in SAP B1 using DI API with updating the quantity (inventory) in the various tables of stock

Hi All ,

I'm new here and i need  help.

I need to be able to insert sales order data to SAP B1 using DI API.

Actually i can insert sales order SAP B1 using DI API and  when i log in SAP i found  the sales order created via DI API but the quantity in OITW and OITM table does not change.

Do I have to substract the quantity in OITW and OITM or sap will make the adjustment itself and how.

Any help would be very much appreciated.

Former Member
Former Member replied

Hi,

When you add document you first have to check if the item in the document row have sufficient batchNumber and batchquantity, if you have this quantityBatch add the document via DI normally

But in the lines you have to set the exat batchnumber and batcquantity for each item.

maybe this help you

For i = 0 to orderrow.count -1 do

oOrd.Lines.SetCurrentLine(i)

oOrd.Lines.ItemCode=....

oOrd.Lines.Price=...

....

......

   j=0

  

'''''Repeat until item quantity is satisfy by batch quantity(you can have 1 batcnumber or more)

    For batchnumberofItem in (OBTNjoinOBTQwithqnty>0)  do

       oOrd.Lines.BatchNumbers.SetCurrentLine(j)

       oOrd.Lines.BatchNumbers.BatchNumber = BatchNumber

       oOrd.Lines.BatchNumbers.Quantity = Quantity

       oOrd.Lines.BatchNumbers.Add()

       oOrd.Lines.Quantity = oOrd.Lines.Quantity + oOrd.Lines.BatchNumbers.Quantity

       j+=1

     next batchnumberofItem

oOrd.Lines.Add()

Next i

Regards, Alessandro

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question