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

is it recommended to use loop inside loop?

Former Member
0 Likes
495

hi friends,

itab = internal table and wa = work area.

Example: loop at itab1 into wa1.

loop at itab2 into wa2 where <f1> = wa1-<f1>.

endloop.

endloop.

is it recommended to use loop inside loop when large amount of records are there in both itabs?

if not recommended then please give mr the solutiuon to do it.

Thanks.

Regards,

Mihir

3 REPLIES 3
Read only

Former Member
0 Likes
469

Hi,

You may use READ TABLE itab2 inside LOOP itab2 ..ENDLOOP.

Regards,

Darren

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
469

it depends, sometimes its inevitable to avoid loop inside a loop.

In your case if you want to fetch only a unique record from itab1 based on wa1 , then use READ statement else loop is the only option may be loop with WHERE clause.

Read only

ThomasZloch
Active Contributor
0 Likes
469

FAQ, please search for "loop inside loop" or "nested loops" in these very forums.

Thread locked.

Thomas