‎2008 Jan 15 1:25 PM
loop at itab where (condi).
......
endloop.
can i have a dynamic where clause for a loop statement and HOW?
‎2008 Jan 15 1:35 PM
‎2008 Jan 15 1:42 PM
Hi,
Try like this.
TYPES: cond(72) TYPE C.
DATA: condtab TYPE TABLE OF cond.
APPEND 'CARRID = ' 'LH' ' AND' TO condtab.
APPEND 'CITYTO = ' 'NEW YORK' ' .' TO condtab.
loop at itab where (condtab).
......
endloop.
otherwise u can use the FM 'RH_DYNAMIC_WHERE_BUILD' for building the dynamic where clause.
Rewards points if helpful.
Regards,
Srinivas Ch
‎2008 Jan 15 1:44 PM
‎2008 Jan 15 1:44 PM
Taken directly from F1 help.
Addition 3
... WHERE log_exp
Effect
WHERE can be specified with all table-types. After WHERE, you can specify any logical expression log_exp in which the first operand of any singular comparison is a component of the internal table. For this reason, all logical expressions are possible except for IS ASSIGNED, IS REQUESTED and IS SUPPLIED. Dynamic specification of a component through bracketed character-type data objects is not possible. Loops at sorted tables must have compatible operands of the logical expression. All rows are read for which the logical expression is true.
Regards,.
Rich Heilman
‎2008 Jan 15 2:12 PM
Hi mate your question is your answer. You can have a syntax like what u specified.
loop at Itab where rec1 = 'xyz'.
endloop.
So what this loop does is ..It will loop only records where the rec1 is 'XYZ'.
Regards,
Raghav