‎2007 Sep 27 2:01 PM
Hi,
I have one requirement.
In internal table first column is key column. All the other columns are entirely dependent on key column. but each row of each column itself is a internal table.
All these secondary internal table should be displayed without any blank lines in between.
e.g. One Sales Order can have many deliveries, Each delivery can have many bills. Report should displayed like
Oreder No Delivery No. Billing Doc No.
O1 O1D1 O1D1B1
O1D2 O1D1B2
O1D3 O1D1B3
O1D2B1
O1D3B1
O1D3B2
So in above example Delivery & billing are two separate internal tables which are dependent on Order No. No relation is required between Delivery & Billing Column.
Also No of entries in all secondary internal tables may vary.
So how to display this in report.
I have used do...Enddo. & reading all the secondary internal tables for current index & appending it to final internal table. Is there any alternative method?
Thanks in Advance
Regards,
Sunil H.
‎2007 Sep 27 2:17 PM
try a nested loop.
loop at itab.
loop at secondary_itab1.
endloop.
loop at secondary_itab2.
endloop.
endloop.
‎2007 Sep 27 2:23 PM
Sunil,
I do not think that you can improve on your own solution.
The logic is clear and easy to maintain.
The table reading via index is efficient.
An alternative that looped through each secondary internal table in turn would need to read and modify your final internal table as well as append to it, all of which would need tricky logic with indexes. I would expect that this would be less efficient too, with repeated modification of the same row.
John