Dialog Modules and Event Blocks
Besides procedures, there are two further types of processing blocks. However, they do not have a parameter interface and do not allow declaration of local data:
AT SELECTION-SCREEN and
GET are exceptions but they should not be exploited):
- Dialog modules
Dialog modules are introduced using the statement MODULE and ended using the statement
ENDMODULE. These modules form the functional interface between classic dynpros and the associated ABAP program. They are called from within the dynpro flow logic.
- Event blocks
Event blocks are introduced by the corresponding keyword and implicitly ended by the next processing block. The processing of an event block is triggered by the ABAP runtime environment when the relevant event occurs. There are event blocks for:
- Loading a program (
- Reporting events that occur during the processing of an executable program (with a logical database)
- Selection screen events (
AT SELECTION-SCREEN ...)
- List events of classic list processing (
No implementations in dialog modules and event blocks
Only use dialog modules and event routines if they are necessary from a technical viewpoint. In these cases, do not implement the required function. Instead, call the relevant (local) methods.
Since it is not possible to declare local data in dialog modules and event blocks, you cannot implement any useful program logic. This means that any dialog modules and event blocks (provided that they are still necessary) should only contain one method call. If you use ABAP Objects consistently, only the following elements are required:
INITIALIZATIONas the program constructor in cases where program types other than class pools are used
- Dialog modules and
AT SELECTION-SCREENwhen classic dynpros and selection screens are processed
START-OF-SELECTIONin executable programs for background processing To improve readability, you should always specify the statement explicitly (although it is optional in many situations).
- Although possible in the syntax, you should never specify an event block more than once within a program.
LOAD-OF-PROGRAM in a function group is basically the same as using
a static constructor in a global class. In executable programs, you can use
INITIALIZATION instead, if any parameters passed using
SUBMIT need to be evaluated.
The following source code shows the PAI modules of the function group DEMO_CR_CAR_RENTAL_SCREENS from the package SABAP_DEMOS_CAR_RENTAL_DYNPRO. The screens in this package can be called using transaction DEMO_CR_CAR_RENTAL. These dialog modules adhere to the above rule. They do not contain their own implementations. They call methods of a local class of the function group.
MODULE cancel INPUT.
MODULE user_command_0100 INPUT.
MODULE customers_mark INPUT.
MODULE reservations_mark INPUT.