Processing Blocks  

In the PAI event of the selection screen, the event

AT SELECTION-SCREEN ON BLOCK <block>

is triggered when the contents of all of the fields in a block are passed from the selection screen to the ABAP program. You define a block by enclosing the declarations of the elements in the block between the statements SELECTION-SCREEN BEGIN OF BLOCK <block> and SELECTION-SCREEN END OF BLOCK <block>. You can use this event block to check the consistency of the input fields in the block. If an error message occurs within this event block, the fields in the block are made ready for input again on the selection screen.

REPORT EVENT_DEMO.

SELECTION-SCREEN BEGIN OF BLOCK PART1 WITH FRAME.
  PARAMETERS: NUMBER1 TYPE I,
              NUMBER2 TYPE I,
              NUMBER3 TYPE I.
SELECTION-SCREEN END OF BLOCK PART1.

SELECTION-SCREEN BEGIN OF BLOCK PART2 WITH FRAME.
  PARAMETERS: NUMBER4 TYPE I,
              NUMBER5 TYPE I,
              NUMBER6 TYPE I.
SELECTION-SCREEN END OF BLOCK PART2.

AT SELECTION-SCREEN ON BLOCK PART1.

  IF NUMBER3 LT NUMBER2 OR
     NUMBER3 LT NUMBER1 OR
     NUMBER2 LT NUMBER1.
     MESSAGE E020(HB).
  ENDIF.

AT SELECTION-SCREEN ON BLOCK PART2.
  IF NUMBER6 LT NUMBER5 OR
     NUMBER6 LT NUMBER4 OR
     NUMBER5 LT NUMBER4.
     MESSAGE E030(HB).
  ENDIF.

If the user does not enter numbers in ascending order in one of the blocks, the whole of the corresponding block is made ready for input again.