‎2007 Oct 03 6:58 PM
Alright, I have the following block of code and I want to make it so that s_budat, s_bwart, and s_werks are manditory. However, I do not want to put OBLIGATORY in the code because that requires each to be filled before you can do a range or multiple selections. I tried to fix the problem by adding the AT SELECTION-SCREEN block but that acts the same as adding OBLIGATORY for the three select-options. Is there a way to do what I want?
**----------------------------------------------------------------------
* S E L E C T I O N - S C R E E N
**----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK required WITH FRAME TITLE text-001.
PARAMETERS: p_spras TYPE makt-spras DEFAULT 'EN' OBLIGATORY,
p_k TYPE i DEFAULT 5 OBLIGATORY. "Amount of days to look at
SELECT-OPTIONS: s_budat FOR mkpf-budat, "Document Date
s_bwart FOR mseg-bwart, "Movement type
s_werks FOR mseg-werks. "Plant Number
SELECTION-SCREEN END OF BLOCK required.
SELECTION-SCREEN BEGIN OF BLOCK optional WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_matnr FOR mseg-matnr, "Material number
s_matkl FOR mara-matkl. "Material group
SELECTION-SCREEN END OF BLOCK optional.
at selection-screen on block required.
if s_budat[] is initial.
message 'Please enter values for the date range' type 'E'.
call screen 1000.
endif.
if s_bwart[] is initial.
message 'Please enter values for the movement type(s).' type 'E'.
call screen 1000.
endif.
if s_werks[] is initial.
message 'Please enter values for the plant number(s).' type 'E'.
call screen 1000.
endif.Davis
‎2007 Oct 03 7:02 PM
Instead of using event AT SELECTION SCREEN, do the validation in START OF SELECTION. If the values for select options are not entered, instead of error message, give a Success message and use STOP command, so that control will remain on Selection screen and user can reenter values.
‎2007 Oct 03 7:02 PM
Instead of using event AT SELECTION SCREEN, do the validation in START OF SELECTION. If the values for select options are not entered, instead of error message, give a Success message and use STOP command, so that control will remain on Selection screen and user can reenter values.
‎2007 Oct 03 7:13 PM
‎2007 Oct 03 7:03 PM
Hi,
I think your codes are fine if you don't want to add obligatory options for select-options.
Please check FM SELECT_OPTIONS_RESTRICT.
Regards,
Ferry Lianto