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

about Dynamic Conditions

Former Member
0 Likes
663

hello,

if i want to use Dynamic Conditions in select,how can i do? Dynamic Conditions 'where'.

hello,

if i want to use Dynamic Conditions in select,how can i do? Dynamic Conditions 'where'.

4 REPLIES 4
Read only

Former Member
0 Likes
620

Hi.

PARAMETERS: airline(2) TYPE C,

date TYPE D.

DATA: where_clause TYPE STRING,

connid TYPE sflight-connid.

CONCATENATE 'carrid = ''' airline ''''

' AND fldate = ''' date '''' INTO where_clause.

SELECT connid FROM sflight INTO connid

WHERE (where_clause).

WRITE: / date, airline, connid.

ENDSELECT.

Read only

uwe_schieferstein
Active Contributor
0 Likes
620

Hello Hong

You can also use function module <b>RH_DYNAMIC_WHERE_BUILD</b> to automatically generate WHERE clauses consisting of AND conditions. The itab containing the WHERE clauses can, of course, be modified and adjusted.

Regards

Uwe

Read only

Former Member
0 Likes
620

Hi,

TABLES: VBAK.

SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.

DATA: lV_STR1(20) TYPE C VALUE 'VBELN IN S_VBELN.'.

DATA: GI_WHERE(72) OCCURS 0 WITH HEADER LINE.

GI_WHERE = LV_STR1.

APPEND GI_WHERE.

DATA GI_VBAK LIKE VBAK OCCURS 0 WITH HEADER LINE.

SELECT VBELN

INTO TABLE GI_VBAK

FROM VBAK

WHERE (gi_where).

Regards

amole

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
620

Hi,

You can build a string of the where clause using the concatenate and then pass that string to select as follows.

SELECT FROM table into table itab where (where_string).

Regards,

Sesh