cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Maybe you could add a delivery too, so the standard sap update the quantity automatically

Regards, Alessandro

Former Member
0 Kudos

Hi Eric

    

Thank’s for your answers.

If I have understand your last answer, you propose to set a values for SerialNumbers properties
and BatchNumbers  properties this action  will allow to  "reserve (allocated) the goods.

I have a question, perhaps it is a stupid question, but I don’t found  which is the value to be affected in SerialNumbers  and / or   BatchNumbers ?

Regards.

Former Member
0 Kudos

Hi Samy,

These are collections of objects, just like Document_Lines and are used in the same way.

Regards,

Eric

Former Member
0 Kudos

Hi Eric,

Sorry, I don’t understand your suggestion.

Below, the part of the code use to add the sales order line:

vOrder.Lines.SetCurrentLine (vOrder.Lines.Count - 1)

vOrder.Lines.ItemCode = “000025”

vOrder.Lines.ItemDescription = “TEST”

vOrder.Lines.Quantity=1

vOrder.Lines.BatchNumbers      ==>   Which is  the value to be affected ?

vOrder.Lines.SerialNumbers      ==>   Which is  the value to be affected ?

vOrder.Lines.Add

Regards

Former Member
0 Kudos

Please ALL any suggestion about my request

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Alessandro,

It's working fine Thanks Alessandro. and Thanks FOR ALL (Eric,Kerremans,Silambu) I appreciate your help very much,

Answers (3)

Answers (3)

former_member186712
Active Contributor
0 Kudos

Hi Samy,

When you create a SO only the Committed quantity is changed.

Regards,


Former Member
0 Kudos

Thank you for your responses.

    

Sorry I have expressed incorrectly my question from the allocated of the quantity at
the stock tables, below the steps which I have realized to verify if the creation of the sales order via DI-API is correctly realized.

Step 1 :  Found sales order created via DI-API

 

Step 2 :
Check if the quantity validated is reserved in the : selected batches table in the Batch Number Selection Form

==> But when i created directly the sales order via SAP B1, and when I check the selected
batches in the Batch Number Selection Form in SAP, I found the quantity validated.


My question, why the selected batches in the Batch Number Selection Form is empty when I create the sales order via DI-API and how resolved this problem.

Former Member
0 Kudos

Hi Samy,

I remind to have worked on this one (for sure for a Customer) but I don't remind if it was also to answer a question on the forum.

Basically, on the Documents_Lines property of the Sales Order (type of Documents) you have two properties, which are collections: SerialNumbers and BatchNumbers. By using them, you will be able to "reserve" effectively the goods.

Regards,

Eric

Former Member
0 Kudos

Hi Eric

    

Thank’s for your answers.

If I have understand your last answer, you propose to set a values for SerialNumbers properties
and BatchNumbers  properties this action  will allow to  "reserve (allocated) the goods.

I have a question, perhaps it is a stupid question, but I don’t found  which is the value to be affected in SerialNumbers  and / or   BatchNumbers ?

Regards.

silambarasan_rajendran
Active Contributor
0 Kudos

Hi samy,

Welcome!

I suggest you to open SAP application and make manual entry check stock and all. The same thing applicable by posting via DI API also.

Thanks & Regards,

Silambu

Former Member
0 Kudos

Hi Silambu,

I disagree on this one... And Ad is correct: functionally an order has to have no impact on the stock, neither on the G/L.

If you do manual transactions to modify the stock, when the order is going to be converted in Delivery / Invoice the stock will be updated again, so the stock operation will have to be posted twice.

Personally I woud prefer to know why the stock needs to be modified when an order is posted... And all in all, this is more a consultancy question than an SDK one.

Regards,

Eric

silambarasan_rajendran
Active Contributor
0 Kudos

Hi Eric,

I mean, if samy is making entry manually he come to knows whether the stock is affecting or not.

An order does not change the quantities in stock.

When you create a delivery/invoice (from order) the stock is changed accordingly.

When you create a SO, only the Committed quantity is changed.




Thanks,

silambu

AdKerremans
Active Contributor
0 Kudos

Hi Samy,

An order does not change the quantities in stock.

When you create a delivery (from order) the stock is changed accordingly.

Regards

Ad