Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Screens →  User Interface 

Screens, GUI Status and Function Codes

The example shows how to set the GUI status and evaluate function codes.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_gui_status.

DATA: ok_code TYPE sy-ucomm,
      save_ok LIKE ok_code,
      output  LIKE ok_code.

CALL SCREEN 100.

MODULE init_screen_0100 OUTPUT.
  SET PF-STATUS 'STATUS_100'.
  SET TITLEBAR '100'.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      LEAVE PROGRAM.
    WHEN OTHERS.
      output = save_ok.
  ENDCASE.
ENDMODULE.

Description

The static next screen number of screen 100 is 100. The screen field of output has been defined as not ready for input in the Screen Painter. The module init_screen_0100 sets the GUI status status_0100 and the title 100 in the PBO event. All function codes are available as menu items but not all of them have been assigned to a function key. The function codes of the standard toolbar enable the icons and automatically assign them a function key. Some of the additional function keys are assigned to the application toolbar. The module user_command_0100 first assigns the contents of the field ok_code to the auxiliary variable save_ok and initializes ok_code. This procedure is always recommended since this makes sure that the screen field ok_code is also reinitialized in the PBO event and does not contain any unintended value. Then the function code chosen is assigned to the field output and displayed in the corresponding screen field, except for BACK, EXIT, and CANCEL. Cancel exits the program. The function code SELE can be passed to the ABAP program in one of the following ways, for example:

  • Choosing Choose in the Edit menu
  • Choosing the Choose pushbutton in the application toolbar
  • Choosing F2 on the keyboard
  • Pressing the right mouse-button and choosing Choose
  • Double-clicking the screen field of output
  • Entering SELE into the screen field and choosing ENTER

All other function codes based on their definition and without double-clicking the mouse.