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

Nested Loops

Former Member
0 Likes
854

Hi,

WHAT R THE EFFECTS OF ISSUING NESTED LOOPS STATEMENTS INSIDE A PROGRAM?HOW TO OVERCOME THAT PROBLEM?

5 REPLIES 5
Read only

Former Member
0 Likes
674

hI Basu

use read statement instead of loop....

please close u r previous threads which are opened

Read only

former_member386202
Active Contributor
0 Likes
674

hi,

It will affect on performance, so use read statement within loop instead of nested loop.

Thanks,

Prashant

Read only

Former Member
0 Likes
674

In nested loop

for every outer loop, it wants to match the inner loop.

so no of hit is MxN.

u should avoid it.

Read only

Former Member
0 Likes
674

select from table1 to an internal table it1.

select from table2 to an internal table it2 for all entries in table it1.

now

loop at it2.

read table it1 matching common key.

if sy-subrc eq 0.

put inanother internal table.

endif.

endloop.

Read only

Former Member
0 Likes
674

hi

good

Loops

In a loop, a statement block is executed several times in succession. There are four kinds of loops in ABAP:

· Unconditional loops using the DO statement.

· Conditional loops using the WHILE statement.

· Loops through internal tables and extract datasets using the LOOP statement.

· Loops through datasets from database tables using the SELECT statement.

This section deals with DO and WHILE loops. SELECT is an Open SQL statement, and is described in the Open SQLsection. The LOOP statement is described in the sections on internal tables and extract datasets.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3564358411d1829f0000e829fbfe/content.htm

thanks

mrutyun^