cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic selection screen

Former Member
0 Kudos

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 ?

Accepted Solutions (0)

Answers (2)

Answers (2)

saravanan_narayanan
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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