Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dyanamic Select Query

Former Member
0 Likes
600

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.

3 REPLIES 3
Read only

Former Member
0 Likes
476

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.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
476

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

Read only

ThomasZloch
Active Contributor
0 Likes
476

This and much more can be found in the ABAP online documentation

http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_DYNAMIC.htm

Thomas