Start of Content Area

Checkboxes and Radio Buttons with Function Codes  Locate the document in its SAP Library structure

Similarly to on screens, where you can define checkboxes and radio buttons with function codes, you can do the same with checkboxes and radio buttons on selection screens. You do this using the USER-COMMAND addition when you declare the relevant parameters:

PARAMETERS ... AS CHECKBOX | RADIOBUTTON GROUP ... USER-COMMAND <ucom>.

You can assign a function code <ucom> to an individual checkbox. However, a radio button group must have one shared function code, since it is only possible to make the assignment for the first button in the group.

When you select a checkbox or radio button in a group, the runtime analysis triggers the AT SELECTION-SCREEN event and places the function code <ucom> into component UCOMM of the interface work area SSCRFIELDS. You must use the TABLES statement to declare the SSCRFIELDS structure.

After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, checkboxes and radio buttons with function codes are more suitable for controlling dynamic modifications on a selection screen than for controlling the program flow.

Example

REPORT demo_sel_screen_user_command.

TABLES sscrfields.

PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
            rad2 RADIOBUTTON GROUP rad,
            rad3 RADIOBUTTON GROUP rad.

PARAMETERS  check AS CHECKBOX USER-COMMAND check.

AT SELECTION-SCREEN.
  MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.

START-OF-SELECTION.
  WRITE text-002.

This program assigns function codes to a radio button group and a checkbox.