Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  General Dynpros →  Dynpro Fields →  Screen Fields - Examples 

Dynpros, Fields with Reference to ABAP Dictionary

The example shows how dynpro fields can be associated with ABAP Dictionary.

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
    FROM  spfli
    WHERE carrid = @wa_spfli-carrid AND connid = @wa_spfli-connid
    INTO  CORRESPONDING FIELDS OF @wa_spfli.
ENDMODULE.

Description

The static next dynpro number of dynpro 100 is 100. The statement TABLES passes the components of the structure DEMO_CONN from ABAP Dictionary. The structure DEMO_CONN was especially created in ABAP Dictionary for dynpros 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 dynpro, the ABAP Dictionary text for MARK is overwritten with "Cancel"; for all other fields the ABAP Dictionary fields are used. Some fields are no longer ready for input in Screen Painter. Users can enter values for the airline and 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 ABAP Dictionary. These checks are performed automatically before any dialog module is called in the ABAP program. It is not possible for the user to enter an airline not defined in the check table SCARR or to enter any flight numbers not matching the airlines defined in SPFLI, or to enter any values for MARK except " " and "X". Not all these checks need to be programmed 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 dynpro in the init_screen_100 event. The work area demo_conn, declared using the statement TABLES is used as an interface, while the actual data from the database is edited in the work area wa_spfli. If the user fills the Cancel field with "X", the program exits.