01-20-2009 10:58 PM
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.
01-21-2009 2:09 AM
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.
01-21-2009 2:55 AM
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
01-21-2009 4:19 PM
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."