‎2007 Oct 02 4:20 PM
Hi
How do I implement BAPI_SALESORDER_CREATEFROMDAT2 for multiple line items.
I am currently doing this to create a new SO:
loop at it_item into wa_item where group = wa_head-group.
add 10 to lv_item.
lw_item-itm_number = lv_item.
lw_item-material = wa_item-itemupc.
append lw_item to lt_item.
lw_schdl-itm_number = lv_item.
lw_schdl-sched_line = 1.
lw_schdl-req_date = sy-datum.
lw_schdl-req_qty = wa_item-itemqty.
append lw_schdl to lt_schdl.
endloop.
It's giving a message:
E |V4 |224 |Missing item number when you changed the <
Thanks!
‎2007 Oct 02 11:56 PM
Hi,
Did you pass the schedule line X parameter ORDER_SCHEDULES_INX with the corresponding ITEM NUMBER (POSNR) and Schedule line number
Thanks
Naren
‎2007 Oct 03 12:21 AM
Hi Naren,
Yes I did. I have already tried passing order_itemx.
Thanks
‎2007 Oct 03 12:25 AM
‎2007 Oct 03 2:03 AM
Here's part of the code the fills the BAPI tables
lw_head-doc_type = pa_auart.
lw_head-sales_org = pa_vkorg.
lw_head-distr_chan = pa_vtweg.
lw_head-division = pa_spart.
lw_head-purch_no_c = pa_file.
lw_head-purch_date = wa_head-postdate.
lw_headx-updateflag = 'I'.
clear lv_item.
loop at it_item into wa_item where group = wa_head-group.
add 10 to lv_item.
lw_item-itm_number = lv_item.
lw_item-material = wa_item-itemupc.
append lw_item to lt_item.
lw_schdl-itm_number = lv_item.
lw_schdl-sched_line = 1.
lw_schdl-req_date = sy-datum.
lw_schdl-req_qty = wa_item-itemqty.
append lw_schdl to lt_schdl.
endloop.
lw_part-partn_numb = lv_kunnr.
lw_part-partn_role = 'AG'.
append lw_part to lt_part.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
order_header_in = lw_head
order_header_inx = lw_headx
importing
salesdocument = lv_vbeln
tables
return = lt_ret
order_items_in = lt_item
order_partners = lt_part
order_schedules_in = lt_schdl.
‎2007 Oct 03 4:28 AM
‎2007 Oct 03 6:14 AM
Hi,
if u r having multiples items mantain two different flags & use command called move
one flag for header i.e 'H'
one flag for item i.e 'I'.
use loop at header table
if it_table-type data = 'H'.
move-corresponding it_ table to sales order header.
Append sales order header table.
else if it_table-typedata = 'I'
move corresponding it_table to sale sorder item.
append to sales order item.
i think it will help full for u.
reward is usefull.
thanks.
Patil.