Skip to Content
0
Former Member
Aug 05, 2009 at 02:21 AM

order creation logic how to pass line items

49 Views

experts

i have the following data in iternal table itab.

po number ,customer number, matnr,quantity ,order date.

1212838383 7494749 8383938833 20 20032009

1212838383 7494749 8383938832 10 20032009

1212838382 7494749 8383938833 20 20032009

1212838384 7494745 8383938823 30 22032009

1212838384 7494745 8584858588 05 22032009

now i want to populate this data into idocs orders segement .

for all po the customer will be the same and i need to create one order for that.

in the above data first 2 lines have same po so i need to create order with 2 line items.

sales org,division,distribution channnel,ordertype will be same for all the records.

loop at itab into workarea.

at new po. "for same po, same header data so i am using AT NEW

edi_dd40-segnum = 1.

edi_dd40-segnam = 'E2EDK14 '.

edi_dd40-mandt = sy-mandt.

edi_dd40-psgnum = psgnum.

e2edk14-qualf = '008' .

e2edk14-orgid = 'NN21.

MOVE e2edk14 TO edi_dd40-sdata.

append edi_dd40 to itab_output.

edi_dd40-segnum = 1.

edi_dd40-segnam = 'E2EDK14 '.

edi_dd40-mandt = sy-mandt.

edi_dd40-psgnum = psgnum.

e2edk14-qualf = '006' .

e2edk14-orgid = 'ni.

MOVE e2edk14 TO edi_dd40-sdata.

append edi_dd40 to itab_output.

....

....

endat.

now the item data comes , so i need to create items with same po.and afetr this i need to submit this data to fm before another diffent po comes.below same customer and po so need to consider as one sales order and submit to fm.

item1 1212838383 7494749 8383938833 20 20032009

item2 1212838383 7494749 8383938833 20 20032009

call function 'MAST_IDOC_DISTRIBUTE'

My concern is how to tell to the system for the same po create the order with multipl line items , do i need to use to AT NEW

or some other commands above?

endloop.