ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Screens → Dynpro Fields → Screen Fields - Examples
Screens, Checkboxes and Radio Buttons
The example shows how to process checkboxes and radio buttons on screens.
Other versions: 7.31 | 7.40 | 7.54
Source Code
PROGRAM demo_dynpro_check_radio .
DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,
box TYPE c.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
CALL SCREEN 100.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'RADIO'.
IF radio1 = 'X'.
field1 = 'Selected!'.
CLEAR: field2, field3.
ELSEIF radio2 = 'X'.
field2 = 'Selected!'.
CLEAR: field1, field3.
ELSEIF radio3 = 'X'.
field3 = 'Selected!'.
CLEAR: field1, field2.
ENDIF.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
Description
The static next screen number of screen 100 is 100. The screen fields field1
to field3
have been defined as not ready for input in the Screen Painter.
Choosing one of the three radio buttons triggers the event PAI passing the function code RADIO and the
field contents of the screenfields to the ABAP program. The dialog module user_command_0100
fills the fields field1
to field3
based on the
radio button chosen. They are displayed when the screen is sent the next time. Choosing the checkbox
also triggers the event PAI. In this case, the function CANCEL is passed to the ABAP program, and the dialog module user_command_0100
immediately ends the program.