Selection screens are special screens that are defined with the help of ABAP statements. As programmers do not have access to the flow logic of selection screens, they cannot define dialog modules for selection screens. The ABAP runtime environment fully controls the processing flow of selection screens. To allow programmers to modify the selection screen before it is called (PBO) and react to user actions on the selection screen (PAI), the ABAP runtime environment generates a number of special selection screen events before the selection screen is displayed and after the user has executed actions on the selection screen. Programmers can define event blocks in the program to react to these events.
The basic form of the selection screen events is the AT SELECTION-SCREEN event. This event occurs after the runtime environment has passed all input data from the selection screen to the ABAP program. The other selection screen events allow programmers to modify the selection screen before it is sent and specifically check user input.
Selection screen events occur both during standard and user-defined selection screen processing. The SY-DYNNR system field contains the number of the active selection screen and helps you to determine which selection screen is currently being processed in the event blocks.
For example, a standard selection screen is defined as follows in the declaration part of an executable program:
The following graphic shows the possible selection screen events and their chronological sequence between the INITIALIZATION and the START-OF-SELECTION event. If user-defined selection screens are called, the event sequence is imbedded accordingly in the current program flow.
Selection screen processing starts after the INITIALIZATION event with AT SELECTION SCREEN OUTPUT. The selection screen is then sent to the screen. User actions on the selection screen result in other events that are either used for field or possible entries help, or that trigger PAI processing of the selection screen. During PAI processing, error messages in the relevant event blocks allow users to return to the selection screen. Only if the AT SELECTION-SCREEN event is exited properly, that is not through an error message, are the other events of the executable program triggered, starting with START-OF-SELECTION.
Choosing multiple selection calls the relevant dialog box. Similarly, events are triggered during its PAI processing.