Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Loop performance

sudha_naik
Product and Topic Expert
Product and Topic Expert
0 Likes
467

Hello all

I have a loop which is coded as below ..

LOOP AT ij_cawn

WHERE atinn = j_3apghd-j_3abzd1.

EXIT.

ENDLOOP.

When analysis was done using ST12, this was shown to take huge time. I would like to modify this code as

Read tavel ij_cawn with key atinn = j_3apghd-j_3abzd1.

Binary search is not possible as the table is not sorted . Also I cannot sort it due to some other logic.

Could you please give me your valuable sggestions in thsi ..

Regards

Sudha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
447

hI,

YOUR LOGIC IS RIGHT,

USE READ STATEMENT AND THEN WRITE IF SY-SUBRC = 0.

PERFORM STEPS.

ENDIF.

3 REPLIES 3
Read only

Former Member
0 Likes
448

hI,

YOUR LOGIC IS RIGHT,

USE READ STATEMENT AND THEN WRITE IF SY-SUBRC = 0.

PERFORM STEPS.

ENDIF.

Read only

Former Member
0 Likes
447

Hi,

make a copy of this internal table in other internal table.

sort that internal table. use Binary Search.

It can help you,

Sandeep Kaushik

Read only

Former Member
0 Likes
447

i_temp[] = ij_cawn[].

sort i_temp by atinn.

Read table i_temp with key atinn = j_3apghd-j_3abzd1 BINARY SEARCH.