Skip to Content
author's profile photo Former Member
Former Member

nested loop using two dynamic tables

Hi all,

i'm trying to create a nested loop with two dynamic tables.

However, i cannot yet.

for example;

<table1> has two fields : kunnr and menge, then

<table2> has three fields : kunnr, matnr and menge.

The field kunnr is key field for those two tables.

and the loop will seem like below :

loop at <table1> assigning <line1>.

....loop at <table2> assigning <line2> [where kunnr = <table1>kunnr].

......bla... bla.. bla...

....endloop.

endloop.

However, i could not handle to use this where condition.

Any solution offered will be appreciated.

Thnkx....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 02:58 PM

    Hi

    U can't use the condition in this situation, so u need read all records of second table and check if the condition is sutisfated:

    FIELD-SYMBOLS: <KUNNR1> TYPE ANY,
                                <KUNNR2> TYPE ANY.
    
    LOOP AT <TABLE1> ASSIGNING <LINE1>.
    
       ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <LINE1> TO <KUNNR1>.
    
      LOOP AT <TABLE2> ASSIGNING <LINE2>.
          ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <LINE2> TO <KUNNR2>.
          
          CHECK <KUNNR1> = <KUNNR2>.
      
          BLA BLA BLA
       ENDLOOP.
    ENDLOOP.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 19, 2008 at 01:43 PM

    so i did not use the nested loop. thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.