Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  General Dynpros →  User Interface 

Dynpros, GUI Status, and Function Codes

This example demonstrates 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 dynpro number of dynpro 100 is 100. The screen field of output is defined as not ready for input in Screen Painter. The module init_screen_0100 sets the GUI status status_0100 and the title 100 in the PBO event. All function codes exist as menu entries, but not all of them are assigned to function keys. The function codes in the standard toolbar activate the icons and are automatically assigned to their function keys. 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 helper variable save_ok and initializes ok_code. This procedure is always recommended since it makes sure that the dynpro field ok_code is also reinitialized in the PBO event and does not contain any unwanted values. Then the function code chosen is assigned to the field output and displayed in the corresponding screen field, except for BACK, EXIT, and CANCEL. The latter exits the program. The function code SELE can be passed to the ABAP program in the following ways:

  • 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 in the command field and choosing ENTER

The other function codes are passed in accordance with their definition, but without the double-click function.