Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Screens →  Dynpro Fields →  Screen Fields - Examples 

Screens, Fields with Reference to Dictionary

The example shows how to establish a reference from the Dictionary to screen fields.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_dictionary .

TABLES demo_conn.
DATA wa_spfli TYPE spfli.

CALL SCREEN 100.

MODULE init_screen_100 OUTPUT.
  CLEAR demo_conn-mark.
  MOVE-CORRESPONDING wa_spfli TO demo_conn.
  CLEAR wa_spfli.
ENDMODULE.

MODULE user_command_0100 INPUT.
  IF demo_conn-mark = 'X'.
    LEAVE PROGRAM.
  ENDIF.
  MOVE-CORRESPONDING demo_conn TO wa_spfli.
  SELECT  SINGLE cityfrom airpfrom cityto airpto fltime deptime arrtime
    INTO  CORRESPONDING FIELDS OF wa_spfli
    FROM  spfli
    WHERE carrid = wa_spfli-carrid AND connid = wa_spfli-connid.
ENDMODULE.

Description

The static next screen number of screen 100 is 100. The statement TABLES adopts the components of the structure DEMO_CONN from the ABAP Dictionary. The structure DEMO_CONN has been especially created in the ABAP Dictionary for screens of the flight data model. Apart from the components of the database table SPFLI, there is also a component MARK whose domain S_FLAG only defines the fixed values " " and "X". On the screen, the Dictionary text for MARK has been overwritten with "Cancel"; for all other fields the Dictionary texts were taken. Some of the fields were deactivated in the Screen Painter. The user is allowed to enter values for the airline and the flight number. In this process, the user is automatically assisted by the field and the input help and the valid value check against check tables of the Dictionary. These checks are performed automatically before any dialog module is called in the ABAP program. It is neither possible for the user to enter an airline which is not defined in the check table SCARR, nor to enter any flight numbers not matching the airlines defined in SPFLI nor to enter values for MARK except " " and "X". You do not need to program these checks in the ABAP program. The module user_command_0100 of the ABAP program reads additional values for the checked key from the database table SPFLI and sends them to the screen in the init_screen_100 event. The work area demo_conn declared using the statement TABLES is used as the interface, while the actual data is processed in the data area wa_spfli. If the user fills the Cancel field with "X", the program is quit.