I am assuming you mean ITEM rows.
If that is the case then it doesn’t matter how many rows there are.
You need to have two internal tables. Lets call them i_orders and i_items.
data: begin of i_orders occurs 10 with header line, “all the VBAK fields needed
order_num like VBAK- VBELN,
sold_to like VBAK- KUNNR,
ship_to like VBAK- VBELN,
PO_num like VBKD- BSTKD,
PO_DATE like VBKD- BSTDK,
.
.
.
end of i_orders .
data: begin of i_items occurs 10 with header line, “all the VBAP (item) fields needed
order_num like VBAK- VBELN,
item_num like VBAP- POSNR,
item_num like VBAP- MATNR,
item_num like VBAP- KWMENG,
item_num like VBAP- VRKME,
.
.
.
end of i_items .
fill i_orders:
i_orders – VBELN = ‘12345’.
i_orders – VBELN = ‘22334’.
fill i_items:
i_items–VBELN = ‘12345’. i_items– POSNR = ‘10’. i_items– MATNR = ‘445544’.
i_items–VBELN = ‘12345’. i_items– POSNR = ‘20’. i_items– MATNR = ‘555555’.
i_items–VBELN = ‘12345’. i_items– POSNR = ‘30’. i_items– MATNR = ‘666666’.
i_items–VBELN = ‘12345’. i_items– POSNR = ‘40’. i_items– MATNR = ‘777777’.
i_items–VBELN = ‘12345’. i_items– POSNR = ‘50’. i_items– MATNR = ‘888888’.
i_items–VBELN = ‘22334’. i_items– POSNR = ‘10’. i_items– MATNR = ‘232323’.
i_items–VBELN = ‘22334’. i_items– POSNR = ‘20’. i_items– MATNR = ‘343434’.
i_items–VBELN = ‘22334’. i_items– POSNR = ‘30’. i_items– MATNR = ‘454454’.
Etc.
Loop at i_orders.
Perform header_BDC using i_orders-vbeln .
Loop at i_items where vbeln = i_orders-vbeln
Perform items_BDC.
Endloop.
call transaction ‘VA01’ using bdcdata.
Endloop.
Discuss This Question: