‎2008 Aug 14 6:06 AM
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...
‎2008 Aug 14 6:10 AM
Hi
please explain your req further ur saying in both cases it should work???
regards
vivek
‎2008 Aug 14 6:13 AM
it should work for all selection options....either if i give 1 field or 2 fields or 5 fields...
‎2008 Aug 14 6:14 AM
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.
‎2008 Aug 14 6:17 AM
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 .
‎2008 Aug 14 6:41 AM
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