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

Select-Options question

Former Member
0 Likes
559

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
520

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.

3 REPLIES 3
Read only

Former Member
0 Likes
521

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.

Read only

0 Likes
520

Ashish, thanks so much, that did the trick!

Davis

Read only

ferry_lianto
Active Contributor
0 Likes
520

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