2007 Sep 17 11:33 AM
hai i want to write the dyanamic where clause to my select statments can any one suggest me how to do it
regards
afzak
2007 Sep 17 11:35 AM
hai i want to write the dyanamic where clause to my select statments can any one suggest me how to do it
regards
afzak
2007 Sep 17 11:35 AM
2007 Sep 17 11:39 AM
hai the requierment is that i dont know the where clause till runtime i mean whcih fields i have to pass to select statment and what conditions like or and, so once i may get there fields and next time 4 fields and conditions may differ or and , so i want to build the where clause based on this
regards
afzal
2007 Sep 17 11:50 AM
hi... u can select dynamic fields as below..
data: str type table of string.
data: st type string.
(here u can append ur fields' name into str which u want to..
ex.
st = 'carrid'.
append st to str.
)
select (str) from spfli into corresponding fields of table it_spfli.
this way u can select dynamic fields int select query..
2007 Sep 17 11:36 AM
2007 Sep 17 11:40 AM
2007 Sep 17 11:41 AM
hi
u should create a screen in screen painter and put a button
where condition there and text boxes
and then u can create u r own
there is posibility in screen painter
2007 Sep 17 11:48 AM
SELECT * FROM <db table> into <wa> WHERE (<cond_syntax>).
you can build the cond_syntax programatically by using string operations like concatenate.
2007 Sep 17 11:57 AM
Hi,
Dynamic " where" can be achieved by the FM
CALL FUNCTION 'AIBZ_FILL_WHERE_CLAUSE'
EXPORTING
i_tabname =
it_select =
IMPORTING
es_where_clause = .
and pass all the exporting parameters.
Rvert back if any issues,
Reward with points if helpful.
Regards,
Naveen
2007 Sep 17 12:01 PM
Hi Afzal,
REPORT demo_select_dynamic_conditions .
DATA: cond(72) TYPE c,
itab LIKE TABLE OF cond.
PARAMETERS: city1(10) TYPE c, city2(10) TYPE c.
DATA wa TYPE spfli-cityfrom.
CONCATENATE 'CITYFROM = ''' city1 '''' INTO cond.
APPEND cond TO itab.
CONCATENATE 'OR CITYFROM = ''' city2 '''' INTO cond.
APPEND cond TO itab.
CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO cond.
APPEND cond TO itab.
LOOP AT itab INTO cond.
WRITE cond.
ENDLOOP.
SKIP.
SELECT cityfrom
INTO wa
FROM spfli
WHERE (itab).
WRITE / wa.
ENDSELECT.
Thanks & Regards,
Sai
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |