‎2005 Jul 13 4:52 PM
Hello Expert Abapers,
how to use a variable in the where condition..
select * from (Var_tab_name)
into itab
where (var1) = 'A'
but i know this expression where (var1) is not allowed, but what is the alternative to this.
Thanks for any suggestions.
BWer
‎2005 Jul 13 5:16 PM
Hi,
<b>Dynamic Conditions</b>
To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of <itab>. However, you may only use literals, and not the names of data objects. The internal table can also be left empty.
If you only want to specify a part of the condition dynamically, use:
SELECT ... WHERE <cond> AND (<itab>) ...
You cannot link a static and a dynamic condition using OR.
You may only use dynamic conditions in the WHERE clause of the SELECT stateme
example:
data: begin of myselection occurs 0,
line(72),
end of myselection.
data char(1) value 'A'.
myselection-line = 'var1 = char'.
append myselection.
select * from (Var_tab_name)
into itab
where (myselection) .
Message was edited by: Svetlin Rusev
‎2005 Jul 13 5:16 PM
Hi,
<b>Dynamic Conditions</b>
To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of <itab>. However, you may only use literals, and not the names of data objects. The internal table can also be left empty.
If you only want to specify a part of the condition dynamically, use:
SELECT ... WHERE <cond> AND (<itab>) ...
You cannot link a static and a dynamic condition using OR.
You may only use dynamic conditions in the WHERE clause of the SELECT stateme
example:
data: begin of myselection occurs 0,
line(72),
end of myselection.
data char(1) value 'A'.
myselection-line = 'var1 = char'.
append myselection.
select * from (Var_tab_name)
into itab
where (myselection) .
Message was edited by: Svetlin Rusev