On a selection screen, two radio buttons should switch between two sets of input fields, and one field needs its own check. How do you build that, and which events do you use?
Say your answer out loud first.
Practise another way
I give the radio button group a USER-COMMAND, so clicking it raises PAI at once instead of waiting for Enter. I put the two field sets into modification groups with MODIF ID.
In AT SELECTION-SCREEN OUTPUT I loop at SCREEN and set active to 0 for the group that does not apply, then MODIFY SCREEN. The single-field check goes into AT SELECTION-SCREEN ON that field, so an error makes only that field ready for input again.
Building blocks.
USER-COMMAND fcodeon a checkbox, radio button group or list box: a click raises the selection screen PAI right away. Without it the screen only changes after Enter.MODIF ID xyzputs a parameter or select-option into a modification group (three characters, found inscreen-group1).AT SELECTION-SCREEN OUTPUTis the PBO of the selection screen, the only place whereMODIFY SCREENhas an effect for selection screens.AT SELECTION-SCREEN ON parachecks one field; anEmessage there reopens only that field.- For the function code, declare
TABLES sscrfieldsand readsscrfields-ucomm; SAP documents thatsy-ucommis not guaranteed to hold the same value.
TABLES sscrfields.
DATA: gv_order TYPE vbeln_va,
gv_deliv TYPE vbeln_vl.
PARAMETERS: p_ord RADIOBUTTON GROUP mode USER-COMMAND mode DEFAULT 'X',
p_dlv RADIOBUTTON GROUP mode.
SELECT-OPTIONS: s_order FOR gv_order MODIF ID ord,
s_deliv FOR gv_deliv MODIF ID dlv.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN INTO DATA(scr).
IF ( p_ord = abap_true AND scr-group1 = 'DLV' )
OR ( p_dlv = abap_true AND scr-group1 = 'ORD' ).
scr-active = '0'.
MODIFY SCREEN FROM scr.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON s_order.
IF p_ord = abap_true AND s_order[] IS INITIAL.
MESSAGE e002(zsd). " only S_ORDER is ready for input again
ENDIF.
Details interviewers probe.
active = '0'hides the field;input = '0'shows it read-only;required = '1'makes it mandatory. Screen attributes use'0'/'1', notabap_true.- Hiding does not clear a value the user typed earlier. In
START-OF-SELECTION, decide by the radio button, not by which select-option happens to be filled. ON RADIOBUTTON GROUPandON BLOCKexist for checks across a group or block; plainAT SELECTION-SCREENruns last for cross-field checks.- Defaults belong in
INITIALIZATION: assignments inAT SELECTION-SCREEN OUTPUTrun before every display and overwrite user input.
Where this stands. This is classic ABAP for SAP GUI reports, still common on S/4HANA on-premise and Private Edition. In a Fiori elements app the same idea is a filter bar driven by CDS annotations, with field control in the service.
Names USER-COMMAND, MODIF ID, LOOP AT SCREEN in AT SELECTION-SCREEN OUTPUT and ON field for targeted checks, and mentions sscrfields-ucomm and stale hidden values.
Tries to hide fields in AT SELECTION-SCREEN or START-OF-SELECTION, or forgets USER-COMMAND so nothing changes until Enter.
Calling MODIFY SCREEN in AT SELECTION-SCREEN (PAI). It has no effect there; screen changes belong in AT SELECTION-SCREEN OUTPUT.
- How would you make a field read-only instead of hiding it?
- Why read sscrfields-ucomm instead of sy-ucomm?
- How do you add your own F4 help to a select-option?
- How would the same behaviour look in a Fiori elements filter bar?
3 official pages and 5 prep guides. Confidence: high. Checked 3 Dec 2026.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.