LOOP AT WHERE. Vs LOOP.IF. in ABAP

1
622

At first sight, both the statements ( loop at itab where <key> = <val> ;   loop at itab. if <key> = <val>. ) looks like performing the same task.

But when it comes to performance, both beats each other in there own domain.

It all comes down to number of “‘matches” in the WHERE/IF-clause.

In case you have a rare match, the WHERE-method is better.
In case you have an always match, the IF-method is better.

When the match was done on 1-out-1000:

match ratio: 1 - out of - 1000
match ratio: 1 – out of – 1000

When the match was done at 1 – out of -2 :

match ratio: 1 - out of - 2
match ratio: 1 – out of – 2

and when the “match” is matching every line

Match ratio : matching every line
Match ratio : matching every line

 

*source = Harry Dietz

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here