Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Dynpros →  Statements in the Screen Flow Logic →  FIELD →  Handling of messages at event PAI →  Input Checks - Examples 

Dynpros, Input Checks in the Flow Logic

The example illustrates how the input checks can be performed in PAI processing.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_value_select.

DATA: ok_code TYPE sy-ucomm,
      carrier TYPE spfli-carrid,
      connect TYPE spfli-connid.

CALL SCREEN 100.

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

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE module_1 INPUT.
  MESSAGE i888(sabapdemos) WITH text-001 carrier
                        text-002 connect.
ENDMODULE.

MODULE module_2 INPUT.
  MESSAGE i888(sabapdemos) WITH text-001 carrier
                        text-002 connect.
ENDMODULE.

Description

The static next dynpro number of dynpro 100 is 100. The input fields have the fields carrier and connect (taken from the program) assigned to them. The function code of the pubshbutton is EXECUTE.

In the GUI status STATUS_100, the symbol Cancel (F12) is activated by the function code CANCEL with the function type E. Additionally, the function key F8 has the function code EXECUTE assigned to it. The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.
  MODULE init_screen_0100.
PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  FIELD carrier VALUES (NOT 'AA', 'LH', BETWEEN 'QF' AND 'UA').
  MODULE module_1.
  FIELD connect SELECT  *
                  FROM spfli
                  WHERE carrid = carrier AND connid = connect
                  WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                                          WITH carrier connect.
  MODULE module_2.

The user must enter a value for carrier that is in the list following VALUES before module_1 is called. When module_1 is called, connect has not yet been transported. The user can then only enter a value for connect, which exists together with carrier as the primary key in the database table SPFLI. If the user enters a different value, an error message appears in the status bar. Only when a correct value has been entered is connect transported and module_2 called.