2009 Mar 04 3:38 PM
hi
i hava z-table
Ztable with field puid guid key1 key2 key3.
i want to fetch data for key1 key2 key3 runtime.
data : l_key type ztable-key1,
t_ztable type standard table of ztable with header line.
i wrote query as below
select * into table t_ztable from ztable
where puid eq '1',
guid eq '3',
l_key eq 'ght'.
where l_key will be key1,key2 or key3 as per runtime value.
but it is showing error that l_key is non defined.
I know other solution that putting where clause in one string variable.
But i want to ask whether it is possible to pass runtime field name in sele
hi
i hava z-table
Ztable with field puid guid key1 key2 key3.
i want to fetch data for key1 key2 key3 runtime.
data : l_key type ztable-key1,
t_ztable type standard table of ztable with header line.
i wrote query as below
select * into table t_ztable from ztable
where puid eq '1',
guid eq '3',
l_key eq 'ght'.
where l_key will be key1,key2 or key3 as per runtime value.
but it is showing error that l_key is non defined.
I know other solution that putting where clause in one string variable.
But i want to ask whether it is possible to pass runtime field name in sele
2009 Mar 04 3:46 PM
Hi harshalata,
first Check your field l_key exist in that table ztable.
then you can proceed to assigining the value at the run time.
runtime only possible with the existance of that field in that table
Thanks
Edited by: Prasanth on Mar 4, 2009 9:16 PM
2009 Mar 04 3:46 PM
You need to use a dynamic condition, it would be something like this
L_key is the name of the field you want to use dynamically
data: l_key(50)
data: begin of itab occurs 0,
cond(72),
end of itab.
itab-cond = 'puid eq ''''1'''' and'. append itab.
itab-cond = 'guid eq ''''3'''' and'. append itab.
concatenate l_key 'eq' '''''3''''.' into itab-cond separated by space.
append itab
select * into table t_ztable from ztable
where (itab).
2009 Mar 04 3:48 PM
Hi,
In Ztable there are only this fields puid guid key1 key2 key3.there is no field with l_key in table ztable.
so it won't work.
Regards,
Sathish
2009 Mar 04 3:58 PM
hi alll
I want to run query
select * from ztable into table t_ztable
where puid eq 1
guid eq 2
(key1 or key2 or key3) eq 'abc'.
here l_key will hold value either key1,key2,key3 runtime
2009 Mar 04 4:08 PM
I told you already how to do it. You need to fill the condition in a table.
2009 Mar 04 4:14 PM
I can achieve that with putting condition in string.
L_where_clause. no need of table too.
Just asking whether we pass Column name of Table runtime without using itab ot l_where_clause (string)
2009 Mar 04 4:19 PM
You can pass the field name only in where clause by concatenating. we don't any other opions to do that
otherwise you need to look for
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db999535c111d1829f0000e829fbfe/content.htm
a®
2009 Mar 04 5:08 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |