Application Development and Automation 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: 
Read only

Question about BAPI_SALESORDER_CREATEFROMDAT2

former_member220801
Participant
0 Likes
582

I use BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order. From the documentation, all the sales order item data should be put in the table ORDER_ITEMS_IN.

I have filled the following fields:

- ITM_NUMBER

- MATERIAL

- TARGET_QTY

- TARGET_QU

- SALES_UNIT

However, the sales order is created containing item without quanity.

Which fields I must fill in so that to have quantity included in the sales item?

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
541

HI

U have to populate the quantity in schedule line, in the bapi and not as in orders_items_in. insert equavilent lines in the schedule line with line numbers 10, 20, 30 and corresponding QTY

regards

kishore

reward if helpful

3 REPLIES 3
Read only

Former Member
0 Likes
542

HI

U have to populate the quantity in schedule line, in the bapi and not as in orders_items_in. insert equavilent lines in the schedule line with line numbers 10, 20, 30 and corresponding QTY

regards

kishore

reward if helpful

Read only

Former Member
0 Likes
541

Hi

try this code

*----


  • Build order item(s)

*----


l_order_items_in-itm_number = '000001'.

l_order_items_inx-itm_number = '000001'.

*PLANT

l_order_items_in-PLANT = '0180' .

l_order_items_inx-PLANT = 'X'.

***************************************************************

l_order_items_in-material = '0001303043'.

l_order_items_inx-material = 'X'.

l_order_items_in-comp_quant = '100.000'.

l_order_items_inx-comp_quant = 'X'.

APPEND l_order_items_in TO li_order_items_in.

l_order_items_inx-updateflag = 'I'.

APPEND l_order_items_inx TO li_order_items_inx.

*----


  • CALL Bapi

*----


CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = l_order_header_in

order_header_inx = l_order_header_inx

testrun = 'X'

IMPORTING

salesdocument = l_vbeln

TABLES

return = li_return

order_items_in = li_order_items_in

order_items_inx = li_order_items_inx

order_partners = li_order_partners.

regards

kishore

Read only

Former Member
0 Likes
541

Hi,

You need to pass the same into schedule lines. Please refer the code below :

*----


  • Populate schedule Line

*----


CLEAR wa_sch_in.

wa_sch_in-itm_number = l_item_number.

wa_sch_in-sched_line = l_item_number.

wa_sch_in-req_qty = wa_items_in-target_qty.

APPEND wa_sch_in TO i_sch_in.

CLEAR wa_sch_inx.

wa_sch_inx-itm_number = l_item_number.

wa_sch_inx-sched_line = lc_active.

wa_sch_inx-req_qty = lc_active.

wa_sch_inx-req_date = lc_active.

APPEND wa_sch_inx TO i_sch_inx.

Best regards,

Prashant