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

selection-screen

Former Member
0 Likes
554

Hi all,

if i have 5 select-options in the selection-screen...all are NOT mandatory fields...then how do i write the program so that if a user enter only one selction it should work properly and if he uses all fields then the program should show all correct values...

i am writing the code as :

if a1 = ' ' and a2 NE ' ' a3 NE ' ' a4 NE ' ' a5 NE ' '.

elseif a1 NE ' ' and a2 = ' ' a3 NE ' ' a4 NE ' ' a5 NE ' '.

elseif....

........

endif.

Pls help...

5 REPLIES 5
Read only

Former Member
0 Likes
522

Hi

please explain your req further ur saying in both cases it should work???

regards

vivek

Read only

0 Likes
522

it should work for all selection options....either if i give 1 field or 2 fields or 5 fields...

Read only

Former Member
0 Likes
522

Hi,

Just use AND in your WHERE condition of your SELECT query, like

Select * 
   from table 
    into table itab
 where field1 in s_field1
    and field2 in s_field2
    and field3 in s_field3
    and field4 in s_field4
    and field5 in s_field5.

With luck,

Pritam.

Read only

Former Member
0 Likes
522

Hi,

insted of =,

use IN in the where condition ,

like date IN s_date and

time IN s_time

then the system will take care about rest of things .

Read only

Former Member
0 Likes
522

Hi,

If all your select-option inputs are in same table, then u can code like..

SELECT * FROM <TABLE>

INTO TABLE <ITAB>

WHERE <fld1> IN <input1> and

<fld2> IN <input2> and

<fld3> IN <input3> and

<fld4> IN <input4> and

<fld5> IN <input5> .

Else, u have to fetch the records from different tables and bring it into one final table.. Then u can delete the records based on user inputs.

IF <inp1> is not intial .

DELETE itab WHERE <fld1> NOT IN <inp1> .

ELSEIF <inp2> is not intial .

DELETE itab WHERE <fld2> NOT IN <inp2> .

ELSEIF <inp3> is not intial .

DELETE itab WHERE <fld3> NOT IN <inp3> .

ELSEIF <inp4> is not intial .

DELETE itab WHERE <fld4> NOT IN <inp4> .

ELSEIF <inp5> is not intial .

DELETE itab WHERE <fld5> NOT IN <inp5> .

ENDIF.

Regards,

Prem