Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CREATEFROMDAT2 line item assignment

Former Member
0 Kudos

Is there a way to use BAPI_SALESORDER_CREATEFROMDAT2 without having to predict internally assigned line item numbers by SAP?

E.g. creating an order with 2 line items, the 1st line item explodes into a sales BOM, so in order to tie sales order text or schedule line data in for a 2nd line item I need to know the line item number of the 2nd item in tables ORDER_TEXT or ORDER_SCHEDULES_IN.

External systems usually don't know how SAP will explode into items, so I can't believe there is no way to do this with the standard BAPI. Or is everyone out there just using a custom wrapper function that reads the sales BOMs and calculates SAP line item numbers?

6 REPLIES 6

former_member181962
Active Contributor
0 Kudos

Hi Peter,

You do not need to pass any item number to the FM. Let the system do it for you. Let me know if i have understood your question or please revert.

Regards,

Ravi

0 Kudos

Ravi,

No you misunderstood. If I want to send sales order text for a 2nd line item, which goes in the ORDER_TEXT table what line item number will I use in that table? If my 1st item explodes into 10 line items in the sales BOM, then SAP will use something like line item 000120 for the 2nd line item. You will need to pass this SAP generated line item number in the ORDER_TEXT table. How can you avoid having to know that your line item number 2 is really line item 000120 in SAP when you send other data besides what's in the ORDER_ITEMS_IN table?

Peter

0 Kudos

Ok I understand it now, Did you try to propose the item number yourself?

Like giving the line numbers as 000010 and 000020 in both the ORDER_ITEMS_IN and ORDER_TEXT?

Regards,

Ravi Kanth

0 Kudos

As an alternative you can try this method.

Create the Sales Order without the Item texts using the BAPI.

Then use the FM SAVE_TEXT using the parameters HEADER-TDNAME = Concatenation of the Sales Order and the Item number.

Regards,

Ravi

0 Kudos

Thanks Ravi, but all that does not help. Passing the line item 20 in the text or schedule line tables will update the wrong item, because line 20 will then be the 1st item in the BOM of item 10.

Updating the text directly is not a solution either since there are other tables like ORDER_SCHEDULES_IN, ORDER_CONDITIONS_IN that need a line item number as well.

Bottom line it seems like anyone who wants to create or even change orders involving line items that explode into sales BOMs must find a way to predict the SAP assigned line item numbers. That seems strange but I guess that's how it is.

0 Kudos

Did u try passing Line Number say 10 and 20 to you line items and see if the sales BOMs get a different number other than 20