Automatic Input Checks 

In the PAI event, the screen makes a series of automatic input checks. These are carried out before any data is transferred to the ABAP program, and before the screen flow logic is processed. Before the automatic input checks, you can call a single dialog module unconditionally using a special function type. You normally use this dialog module to bypass the checks and leave the screen directly.

If the automatic input checks find an error, a message appears in the status bar of the screen, and the corresponding fields remain ready for input. The user must correct the entries and trigger the PAI again. The actual PAI processing does not start until there are no more errors.

The automatic input checks run in the following order:

Mandatory Fields

If a field is defined as a mandatory field in the Screen Painter, the user must enter a value for it before the PAI processing can start.

Input Format

The values entered in the input fields on the screen must correspond to the data format of the corresponding screen field. For example, the format of a date field (type DATS) is eight characters and has the format YYYYMMDD. All of the characters must be numeric. MM must be 12 or less, and DD must be 31 or less. The system also checks that the specified day is valid for the month.

ABAP Dictionary Checks

If you create an input field in the Screen Painter by copying a ABAP Dictionary field, the screen checks whether:

Automatic input checks

PROGRAM DEMO_DYNPRO_AUTOMATIC_CHECKS.

DATA: OK_CODE LIKE SY-UCOMM,
      DATE TYPE D.

TABLES SDYN_CONN.

CALL SCREEN 100.

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

MODULE CANCEL INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE PAI INPUT.
  MESSAGE I888(BCTRAIN) WITH TEXT-001.
ENDMODULE.

The next screen (statically defined) for screen 100 is 100. It has the following layout:

The date field DATE from the program is assigned to the input field Date. The other input fields are the CARRID; CONNID, and MARK components of the ABAP Dictionary structure SDYN_CONN. All of the fields are mandatory. The function code of the pushbutton is EXECUTE.

In the GUI status STATUS_100, the icon (F12) is active with function code CANCEL and function type E. Furthermore, the function key F8 is assigned to the function code EXECUTE.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.
  MODULE INIT_SCREEN_100.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  MODULE PAI.

The user must fill all of the input fields with valid values before the PAI module can be called:

The user can leave the screen using Cancel (, F12) without entering all values correctly, since the module call is programmed using AT EXIT-COMMAND.