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

Processing multiple dynamic internal tables

Former Member
0 Likes
628

Hi,

I have multiple dyanmic internal tables in my prg like <T01>,<T02>,<T03>.....I have relation between the tables through which I want to process them.

loop at <T01> into <T01_wa>.

loop at <T02> into <T02_wa> where "logical expression".

endloop.

I need to now build the where clause that is the logical expression too dynamically. Say

T01-Text_Id = T02_Text_Id and T01_Attrib = T02_Attrib.

How do I build this where clause and use it in processing the internal table.

Could some one help me this.

Thanks.

3 REPLIES 3
Read only

mvoros
Active Contributor
0 Likes
590

Hi,

it looks like it's not possible to use dynamic condition in LOOP statement. What you can do is to check your dynamic condition in the loop. In case that condition is not fulfilled then you will use statement CONTINUE.


loop at <T01> into <T01_wa>.
  loop at <T02> into <T02_wa>.
  <evaluate condition>
  IF <evaluation> NE 'X'.
    CONTINUE.
  ENDIF.
  endloop.
endloop.

Read only

Former Member
0 Likes
590

Hi Vinni,

Try using this piece of code

DATA:field_key1 TYPE char100,

field_nam1 TYPE char18. "Assumed to be material number

FIELD-SYMBOLS: <f>.

field_key1 = 'MATNR'.

loop at <T01> ASSIGNING <T01_wa>.

ASSIGN COMPONENT 1 OF STRUCTURE <T01_wa> TO <f>.

field_nam1 = <f>.

loop at <T02> ASSIGNING <T02_wa> WHERE (field_key1) = field_nam1.

*Your logic

endloop.

endloop.

All the best.

Regards,

Madhu

Read only

0 Likes
590

loop at <T02> ASSIGNING <T02_wa> WHERE (field_key1) = field_nam1.

For the above line I am getting the error as

"In LOOP...WHERE....the line type of the table must be statically defined."