Reputation: 43
I have some radiobuttons and when I change between them some blocks appear/disappear.
However, if I set parameters as obligatory or required they do not hide unless I fill them. I want to make parameters required but I need to hide them when I change the radiobutton option.
Upvotes: 2
Views: 36514
Reputation: 18483
If you use PARAMETERS ... OBLIGATORY
, this is an unconditional statement - this parameter is required regardless of the other settings. If you need a conditional check, you have to code it for yourself:
PARAMETERS p_chkbuk AS CHECKBOX.
PARAMETERS p_bukrs TYPE bukrs.
AT SELECTION-SCREEN ON p_bukrs.
IF p_chkbuk = abap_true AND p_bukrs IS INITIAL.
MESSAGE 'You need to enter something.' TYPE 'I' DISPLAY LIKE 'E'.
ENDIF.
Upvotes: 2
Reputation:
I guess it's a selection screen...
enable or disable the blocks
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
* Radio button parameter = P_RADIO
* hide the parameter named "to_hide"
IF P_RADIO EQ 'X' AND SCREEN-NAME CS 'TO_HIDE'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
* display the parameter named "to_hide"
IF P_RADIO <> 'X' AND SCREEN-NAME CS 'TO_HIDE'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Upvotes: 4