2012 Dec 21 12:39 PM
Hi Team,
Please help me out here.
I have requirement, where we needs insert records to ztable.
here it is,
I have papulated vbak and vbap internal tables. I used parallel cursor method for this,
nw i needs it insert each record into ztable, where ztable contains both vbak and vbap fields.
ex. for one sales order no, 3 line items are there. so i need to insert 3 records for 3 line items along with vbak values.
Thanks & regrdas,
Mohan
Hi Team,
Please help me out here.
I have requirement, where we needs insert records to ztable.
here it is,
I have papulated vbak and vbap internal tables. I used parallel cursor method for this,
nw i needs it insert each record into ztable, where ztable contains both vbak and vbap fields.
ex. for one sales order no, 3 line items are there. so i need to insert 3 records for 3 line items along with vbak values.
Thanks & regrdas,
Mohan
2012 Dec 21 12:59 PM
More a logical than a programming problem.
Similar to flat ALV lists, repeat the header fields for each line item.
Thomas
P.S. very basic, un-marked as question
2012 Dec 21 1:38 PM
Hi Mohan,
Take a look at the following nested loop to see a basic example of how you might approach such a problem (there are other solutions as well).
LOOP AT header ASSIGNING <header>.
ls_ztable_struc-field1 = <header>-field1.
ls_ztable_struc-field2 = <header>-field2.
LOOP AT item ASSIGNING <item>
WHERE keyfield = <header>-keyfield.
ls_ztable_struc-field3 = <item>-field1.
ls_ztable_struc-field4 = <item>-field2.
INSERT ztable FROM ls_ztable_struc.
IF sy-subrc IS NOT INITIAL.
...handle error...
ENDIF.
ENDLOOP. " <item>
ENDLOOP. " <header>Cheers,
Amy