Skip to content

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

Screens, Input Checks in the Flow Logic

The example illustrates how the input check can be carried out in the PAI processing.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_value_select MESSAGE-ID dw.

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 screen number of screen 100 is 100. The input fields have the fields carrier and connect (taken from the program) assigned to them. The function code of the pushbutton is EXECUTE.

In the GUI status STATUS_100, the icon Cancel (F12) is activated via 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:

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 first enter a value for carrier that matches the value list after VALUES, before the module module_1 is called. When calling module_1, connect is not yet transported. Then, the user can only enter a value for connect, which exists together with carrier as primary key in the database table SPFLI. If the user enters a different value, message 107 from message class AT appears as an error message. connect is not transported and the module module_2 is not called until a valid value is entered.