Skip to Content
author's profile photo
Former Member

Nested Loops

Hi,

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 08:41 AM

    hI Basu

    use read statement instead of loop....

    please close u r previous threads which are opened

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 22, 2007 at 09:14 AM

    hi,

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

    Thanks,

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 01:43 PM

    In nested loop

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

    so no of hit is MxN.

    u should avoid it.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 01:46 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 03:11 PM

    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^

    Add comment
    10|10000 characters needed characters exceeded