2009 Feb 16 7:23 AM
Hi all,
If I have say 6 (fields or) parameters on selection screen & if user enters any 1 any 2 or any combination or all then also data show for that I have to write all permutation combination in if else condition instead of that is there any function module or any logic to do so please help me for that
Ketan
ABAP consultant
Edited by: ketan pande on Feb 16, 2009 8:23 AM
Hi all,
If I have say 6 (fields or) parameters on selection screen & if user enters any 1 any 2 or any combination or all then also data show for that I have to write all permutation combination in if else condition instead of that is there any function module or any logic to do so please help me for that
Ketan
ABAP consultant
Edited by: ketan pande on Feb 16, 2009 8:23 AM
2009 Feb 16 7:25 AM
Hi,
use at selection-screen output validations.
at selection-screen output.
if f1 eq ' ' OR f2 eq ' ' OR f3 eq ' ' OR f4 eq ' ' OR f5 eq ' ' OR f6 eq ' '.( If u want all fields to be entered)
message 'Please make an entry in all fields' type 'S'.
endif.
If u want only some fields to be mandatory use
addition mandatory to parameters declaration.
( Then automatically,system prompts to enter values if user doesnot enter and tries to execute )
2009 Feb 16 7:28 AM
use select-options instead of parameters in your selection-screen . also use "IN" instead of "EQ" in your database query. You don't need for the permutation of the fields entered.
Regards,
Mon Magallanes
2009 Feb 16 7:29 AM
You have to use If else endif conditions for all the combinations if selecting from different tables for parameters.
regards,
Jinson.
2009 Feb 16 7:42 AM
Hi..Use this codings
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN.
IF SCREEN-NAME = 'PARAM1'
OR SCREEN-NAME = PARAM2'
OR SCREEN-NAME = PARAM3'
OR SCREEN-NAME = PARAM4'
OR SCREEN-NAME = PARAM5'
OR SCREEN-NAME = PARAM6'
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
2009 Feb 16 8:01 AM
Hi,
Either you use
- a single select option
- if you have to use multiple parameters, you have to append all values in a range and use it in your select.
Regards.
2009 Feb 16 8:38 AM
Hello Ketan,
Try the following code-snap, hope it helps you.
DATA:
BEGIN OF fs_table,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
fltime TYPE spfli-fltime,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF fs_table.
DATA:
t_table LIKE STANDARD TABLE OF fs_table.
PARAMETERS:
p_carrid TYPE spfli-carrid,
p_connid TYPE spfli-connid,
p_fltime TYPE spfli-fltime,
p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.
SELECT carrid
connid
fltime
cityfrom
cityto
FROM spfli
INTO TABLE t_table
WHERE carrid EQ p_carrid OR
connid EQ p_connid OR
fltime EQ p_fltime OR
cityfrom EQ p_cityfr OR
cityto EQ p_cityto.
LOOP AT t_table INTO fs_table.
WRITE:/ fs_table-carrid,
fs_table-connid,
fs_table-fltime,
fs_table-cityfrom,
fs_table-cityto.
ENDLOOP.If you have got 5 parameters and you mention AND in SELECT query, all the 5 parameters have to fulfill the condition, whereas if you mention OR that checks for only the given value.
Thanks: Zahack
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |