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

input parameters

Former Member
0 Likes
4,179

i have a report with 10 input parameters wherein only two are obligatory, the rest are optional. The problem is, as far as I know, if you use an input parameter that is blank in a WHERE condition of a SELECT statement no records will be selected from a table, correct? Unlike in a select-option wherein if it is blank all records from a table is selected.

The user does not want all input parameters to be set to OBLIGATORY.

Can anyone provide any suggestions wherein if an input parameter is empty this will be disregarded by the SELECT statement? I have several ideas such as creating mulitple SELECT statements wherein the WHERE condition will only use input parameters that has a value entered, but this is to cumbersome.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,389

Hi

Make your parameter as select option with syntax

select-options : so_field for tablename-tablefield with no extension no interval .

This will make select-option appear as parameter on the selection screen,

and in the select query it behaves like select-option, it will fetch data with blank values .

And when value entered it will get taht particular record .

This will not allow user to enter multiple records for the field .

Hope it helps .

Thanks

Praveen

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
2,389

Hi Reethu

When ever you use a selection screen object in select and if its balnk all the data from the table related to that field will get executed..

pa_vbeln is blank.

where vbeln eq pa_vbeln

you will get all the vbeln which are blank which is ZERO.

select-options: so_vbeln for vbak-vbeln. <<<<< blank (no values)

where vbeln in so_vbeln. <<< you will get all the data.. irrespective of the so_vbeln inputs..

Edited by: Jackandjay on Jan 27, 2008 9:50 PM

Read only

Former Member
0 Likes
2,389

Hi,

If no data entered in the input parameter, it will be treated as blank and Select query will fetch only the records with blank field of the respective field.

Then there is no point of avoiding the field from the Select.

If you dont want to use the input parameters in the select query, first fetch all the records into internal table and filter it based on the input parameters. then no point of writing multiple select statements.

Read only

Former Member
0 Likes
2,389

You can try appending values to the parameter.

Read only

Former Member
0 Likes
2,390

Hi

Make your parameter as select option with syntax

select-options : so_field for tablename-tablefield with no extension no interval .

This will make select-option appear as parameter on the selection screen,

and in the select query it behaves like select-option, it will fetch data with blank values .

And when value entered it will get taht particular record .

This will not allow user to enter multiple records for the field .

Hope it helps .

Thanks

Praveen

Read only

Former Member
0 Likes
2,389

Some options:

- In stead of defining a parameter, use a select-option with the

no-intervals and no extension option. You can also restrict other

options of the select-option like CP or NE. (function module

SELECT_OPTIONS_RESTRICT)

- you can use the parameters as part of a dynamic where-clause. Only add

the parameters with values to the dynamic part

- you can use a LIKE option. If parameter is empty, put value '%' in it.

I think I would choose the second option...

Regards,

Chaitanya.

Read only

Former Member
0 Likes
2,389

Hi Reethu,

Praveen's response is the solution for your problem.

Did you try his suggestion?

Regards,

Ravi Kanth Talagana