on 04-26-2012 2:45 PM
Hi,
Created dynamic selection screen in that both parameters and select options available totally 10 fields ( 5 select option and 5 parameter , only 2 is mandatory)
now righting select query in single table based on the selection input passing into the table
suppose selection screen we enter only 2 mandatory fields remaining 8 fields are blank
in this case i am getting dump.
how to right dynamic select query for parameter fields if initial also ?
only one table i am fetching the value ?
Hello Vinoth,
For the parameters fields (of the selection screen) you need explicitly check whether data is entered or not (by derefencing the parameter field value to a field symbol and by checking whether field symbol is assigned and not initial). Based on the fields for which data is entered you construct the dynamic WHERE condition as mentioned by Vengat
To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
Hope this help.s.
BR, Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saravanan,
try this..
You have 10 selection screen parameters. Let us assume from screen u passed values for only 4 parameters. For remaining 6 parameters u can pass '%' as a value.. means
if p_3rdparam is initial
p_3rdparam = '%'.
if p_4th param is initial
p_4thparam = '%'.
like this u need to pass for all the optional parameters.
Now go for select query and in where condition pass the conditions with and operation..
It will work...
Regards
Ramana
Hi
In select query
You can combine two conditions into one using the AND and OR operators:
SELECT ... WHERE <cond 1> OR <cond 2> ...
To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of <itab>. However, you may only use literals, and not the names of data objects. The internal table can also be left empty.
If you only want to specify a part of the condition dynamically, use:
SELECT ... WHERE <cond> AND (<itab>) ...
You cannot link a static and a dynamic condition using OR.
You may only use dynamic conditions in the WHERE clause of the SELECT statement.
Regards
Vengat.G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.