Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to avoid the loop inside the loop? as it reduces the performance.

hi masters,

i have 2 internal tables having 1 same field. eg table itab having f1, f2, f3 fields and itab1 having f1, f4 and f5 fields. let us consider the data in the itab and itab1 is like below given

itab-f1 itab-f2 itab-f3 itab1-f1 itab1-f4 itab1-f5

10 aa 11 10 abc 456

10 bb 15 10 def 655

10 ff 13 10 ghi 456

11 dd 16 10 tre 455

11 zz 24 11 ftr 256

11 ii 54 11 kjh 556

12 hh 24 12 fjk 751

now i want the result in final table like below

f1 f2 f3 f4 f5

10 aa 11 abc 456

10 aa 11 def 655

10 aa 11 ghi 456

10 aa 11 tre 455

10 bb 15 abc 456

10 bb 15 def 655

10 bb 15 ghi 456

10 bb 15 tre 455

10 ff 13 abc 456

10 ff 13 def 655

10 ff 13 ghi 456

10 ff 13 tre 455

11 dd 16 ftr 256

11 dd 16 kjh 556

11 zz 24 ftr 256

11 zz 24 kjh 556

11 ii 54 ftr 256

11 ii 54 kjh 556

12 hh 24 fjk 751

i can get this result using the

Loop at itab.

loop at itab1 where f1 = itab-f1.

process....

endloop.

endloop.

but it is very slow. i want to avoid this loop inside the loop and i want to implement the same program using read table.. like below..

Loop at itab.

Read table itab1 with key ....

process...

endloop.

Is it possible? to get multiple records from itab2 using read statement or with READ statement that using CASE Statement or IF statemetnt.

Plz help me...

Former Member
Not what you were looking for? View more on this topic or Ask a question