Get Example source ABAP code based on a different SAP table
Dialog Modules and Event Blocks
ABAP_BACKGROUND 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 raised by the ABAP runtime framework when the relevant event occurs. There are event blocks for:
Loading a program (LOAD-OF-PROGRAM>)
Reporting events that occur during the processing of an executable program (with a logical database) (INITIALIZATION>, START-OF-SELECTION>, GET>, END-OF-SELECTION>)
List events of classic list processing (AT LINE-SELECTION>, AT USER-COMMAND>)
ABAP_RULE 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.
ABAP_DETAILS 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:
LOAD-OF-PROGRAM> or INITIALIZATION> as the program constructor in cases where program types> other than class pools are used
Dialog modules and AT SELECTION-SCREEN> when classic dynpros and selection screens > are processed
START-OF-SELECTION> in 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.
Latest notes: Using LOAD-OF-PROGRAM> in a function pool 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. ABAP_HINT_END
Example ABAP Coding
The following source code shows the PAI modules of the function pool 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 pool. MODULE cancel INPUT. screen_handler=>cancel( ). ENDMODULE.> MODULE user_command_0100 INPUT. screen_handler=>user_command_0100( ). ENDMODULE.> MODULE customers_mark INPUT. customer_table=>mark( ). ENDMODULE.> MODULE reservations_mark INPUT. reservation_table=>mark( ). ENDMODULE.> ABAP_EXAMPLE_END