‎2010 Feb 25 6:10 PM
Hi,
Can you pls guide me on the use of Dyanamic WHERE Clause in a Select Query?
I came across the syntax:
SELECT * FROM za004 INTO TABLE ia004 WHERE (options).
Here Options is an internal table of type 'RFC_DB_OPT'
But I am unable to fill this internal table correctly.
Can some one pls guild me with sample code.
Regards,
Pankaj Bist.
‎2010 Feb 25 6:32 PM
Check this :
DATA: BEGIN OF lt_options OCCURS 10.
INCLUDE STRUCTURE rfc_db_opt.
DATA: END OF lt_options.
CONCATENATE 'PERIV EQ ' '''' 'V8' '''' ' AND' INTO " <-- PERIV is the field name
lt_options-text.
APPEND lt_options.
CONCATENATE 'BDATJ EQ ' '''' l_pyear '''' INTO
lt_options-text.
APPEND lt_options.
Use lt_options in where condition.
‎2010 Feb 25 6:56 PM
Have a look at souce code of fm
CONVERT_SELECT_INTO_WHERE
ADSPC_CREATE_WHERE_CLAUSE
DYNSQL_GENERATE_WHERE_CLAUSE
FREE_SELECTIONS_RANGE_2_WHERE
‎2010 Feb 25 9:09 PM
This and much more can be found in the ABAP online documentation
http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_DYNAMIC.htm
Thomas