‎2008 Jun 09 2:24 PM
Hi ,
my current program has the following code
Loop at itab1.
..................
loop at itab2
where f1 = itab1-f1.
endloop.
..............
endloop.
in itab1 there 20,000. and itab2 there are 10,000 records
The above code is causing a great bottle neck .is their any way to enhance the performance.
please help .
‎2008 Jun 09 2:27 PM
Use the Parallel Cursor technique.
data: v_tabix type sy-tabix.
Loop at itab1.
..................
Read table itab2 into wa_tab2 with key .........
if sy-subrc eq 0.
v_tabix = sy-tabix.
loop at itab2 into wa_tab2 from v_tabix.
if wa_tab2 ne field1.
exit.
endif.
endloop.
endif.
..............
endloop.Regards
Kannaiah
‎2008 Jun 09 2:27 PM
Use the Parallel Cursor technique.
data: v_tabix type sy-tabix.
Loop at itab1.
..................
Read table itab2 into wa_tab2 with key .........
if sy-subrc eq 0.
v_tabix = sy-tabix.
loop at itab2 into wa_tab2 from v_tabix.
if wa_tab2 ne field1.
exit.
endif.
endloop.
endif.
..............
endloop.Regards
Kannaiah
‎2008 Jun 09 2:27 PM
Hi,
~ if you have any duplicates in itab1, just process the loop for 1st pass.
~ you can use [parallel cursor method|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2bcode%2bfor%2bparallel%2bcursor%2b-%2bloop%2bprocessing]
regards,
madhu
‎2008 Jun 09 2:29 PM
From the ABAP editor go to the menu path Environment->Examples->Performance Examples and look at the Parallel Cursor technique under internal tables->simple algorithms->nested loops.
Gareth.
‎2008 Jun 09 2:34 PM
Write the nested loop logic as shown below. This will reduce the execution time to maximum.
SORT itab1 BY f1.
SORT itab2 BY f1.
LOOP AT itab1.
LOOP AT itab2 FROM w_index.
IF itab1-f1 NE itab2-f1.
w_index = sy-tabix.
EXIT.
ENDIF.
ENDLOOP.
ENDLOOP.
****Reward points if useful
Regards,
Kiran Bobbala
‎2008 Jun 09 2:55 PM