03-27-2008 10:49 PM
Hi, I am new to ABAP and would like to know how to loop at two internal tables. The following is my scenario:
ITAB and ITAB_1 are internal tables with same data and the data is sorted on Fiscal Year Period. Now I want to do is as :
loop at ITAB.
loop at ITAB_1.
endloop.
endloop.
During the first pass through ITAB, I should loop at ITAB_1 zero times. During the second pass through ITAB, I should loop at ITAB_1 1 time and so on. Basically I want to loop through all records in ITAB_1 that are just above my current record in ITAB.
How can I do this? Any ideas.
Thanks and regards.
03-27-2008 10:59 PM
data: current_idx type sy-tabix.
loop at ITAB.
current_idx = sy-tabix - 1.
if sy-tabix > 1.
loop at ITAB_1 to current_idx.
endloop.
endif.
endloop.
03-27-2008 10:59 PM
data: current_idx type sy-tabix.
loop at ITAB.
current_idx = sy-tabix - 1.
if sy-tabix > 1.
loop at ITAB_1 to current_idx.
endloop.
endif.
endloop.
03-27-2008 11:02 PM