06-14-2021 6:28 AM
Hello all,
I have a little problem. I have declared a mandatory field (without obligatory).
However, then the multiple selection does not work without having already inserted a material.
My code looks like this right now:
at selection-screen on s_matnr.
if s_matnr[] is initial.
MESSAGE 'The material number must be filled' type 'E'.
leave LIST-PROCESSING.
endif.
Is there any way to work around this so that the multiple selection works when no material is filled?
Thank you.
06-14-2021 6:29 AM
06-14-2021 6:47 AM
You put the control on the bad event.
AT SELECTION-SCREEN ON ... occurs when you do something on ... so obviously you check if the SELECT OPTIONS is not empty each time you do something on it ...
Maybe what you want to control is, before calling the report, control the SELECT OPTIONS is not empty.
You could do it with AT USER-COMMAND or after START-OF-SELECTION
06-14-2021 12:26 PM
moisy98 When the optional "ON field" addition is used, only the field is transported from the screen to the global variable (of same name). I guess you want to transport the value of the other field, so the easiest solution is to not use "ON field" (only AT SELECTION-SCREEN) so that all screen fields are transported to the global variables and the check can be done on the fields you want (IF field1 ... AND field2 ...).
06-14-2021 7:43 AM
Just curious... if you want a mandatory field... why do not use the OBLIGATORY clause?
06-14-2021 9:43 AM
If I understand correctly maybe you shouldnt use message type E, use message type S or W display like E
06-14-2021 12:21 PM
You could try to perform the check only when user triggers the execution:
" ...
TABLES: sscrfields.
" ...
AT SELECTION-SCREEN ON s_matnr.
CASE sscrfields-ucomm.
WHEN 'PRIN' OR 'ONLI'.
IF s_matnr[] IS INITIAL.
MESSAGE 'The material number must be filled'(001) TYPE 'E'.
ENDIF.
ENDCASE.
This way the check is still executed in the selection screen and the user can enter his selection of material code.
06-14-2021 12:59 PM
raymond.giuseppi it is working even if he doesn't do any action on the SELECT OPTIONS ?
06-14-2021 2:29 PM
I create a short program and the check was executed. (Seems the generated dynpro statements CHAIN and FIELD don't contain additions such as ON INPUT or ON REQUEST)
Also
06-14-2021 2:35 PM
Strange, when you catch an action on a field, and even if there is no action, it is triggered ...
06-14-2021 3:18 PM
Hello Giuseppi,
thank you for your help, but the code doesn't work in my case.
The multiple selection does not work when the material number is not filled already.
Thank you
06-14-2021 3:24 PM
06-14-2021 3:39 PM
i have done it like you told me.
AT SELECTION-SCREEN on s_matnr.
CASE sscrfields-ucomm.
WHEN 'PRIN' OR 'ONLI'.
IF s_matnr[] IS INITIAL.
MESSAGE 'Die Materialnummer muss gefüllt werden' TYPE 'E'.
ENDIF.
ENDCASE.
same situation as before. The multiple selection does not work
06-15-2021 10:05 AM
Try to debug the execution (value of UCOMM is not 'ONLI' or 'PRIN' when click on multiple selection icon) error should come from of another code or from any not removed OBLIGATORY option in the SELECT-OPTIONS statement. (Post declaration of S_MATNR)
06-14-2021 12:22 PM
For information, the statement(s) after MESSAGE ... TYPE 'E' (without INTO) are never executed -> remove this dead code.
06-14-2021 1:55 PM
Thank you for your help. But this doesn't help anyway.
The multiple selection doesn't work anyway when the material number isn't already filled....
Does anyone have a other solution?
06-14-2021 2:33 PM
Dont answer an answer with an answer, use comment so others may know who you are answering...
(read the 'Before answering' text below)
06-14-2021 3:12 PM
Why did you add a 'leave LIST-PROCESSING' statement, IMHO not suitable to handle a selection-screen logic (Hopefully these instructions are dead code, never executed, did you perform some text with a warning message?)