6

The picture

I'd want to be able to have multiple range selections for "Sales order no."

Problem is: when i press the button marked with green, i get the error "Fill in all required entry fields".

I put my main processing block at the START-OF-SELECTION event.

What to do to not have this happen? It seems to me that i should be able to add multiple selections without all the hassle of first filling every other mandatory field.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124

2 Answers2

7

With parameters/select-options set to OBLIGATORY, this won't work. I had the very same problem some time ago, and had no chance to fill the OBLIGATORY input parameters with useful values by default, so I did the following:

  • Remove the OBLIGATORY option from all select-options and parameters
  • Handle the check for obligatory input yourself in cases no F4,help, F1 help or the button next to any select option is pressed:

Code:

AT SELECTION-SCREEN ON s_reswk.

IF sy-ucomm(1) <> '%' AND      " sel screen action request
   sy-ucomm(1) <> '_' AND      " scope option
   s_reswk IS INITIAL.         " Obligatory input missing
   MESSAGE text-e01 TYPE 'E'.  " Error message
ENDIF.
Hans Hohenfeld
  • 1,729
  • 11
  • 14
  • 3
    ...and while you're at it, use a message class. This will allow you to add a documentation text later on. – vwegert Jul 28 '12 at 09:43
  • What is meant by `%` for selection screen action request and `_` for scope option? – gkubed Oct 08 '18 at 20:16
-2

Here's what i found that completely reproduces the behavior set by the OBLIGATORY addition:

1:Take OUT the "OBLIGATORY" addition.

2:at PBO:

LOOP AT SCREEN.
  IF screen-name cs 'name-of-your-select-options-or-parameter'.
    screen-required = 2.
    MODIFY SCREEN.
  ENDIF.

3: at PAI:

if sscrfields-ucomm = 'ONLI'.
    if 'name of your select-option-or-parameter' is initial.
      clear sscrfields.
      message 'Fill in all required fields.'(009) type 'E'.
    endif.
  endif.

Notice the first if statement contains a 'cs' logical operator. That's cuz the name of your control will contain other weird stuff as well. For instance %_P_MATNR_%SCREEN%% (where your parameter was p_matnr).

Also, the declaration : TABLES sscrfields. is necessary.

vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
  • 3
    This is a really bad idea. This way, you enforce entry of the required field when running the programm directly, but the user will be able to schedule it as a background job without entering the same parameter. Also, according to the documentation, screen-required takes either 0 or 1. Setting it to 2 might work now, but change its effect or stop to work altogether without further warning. – vwegert Sep 28 '12 at 17:39