ABAP Report Events: What are the events of Classical Reports ?
Events in ABAP:
ABAP is an event driven Programming language. ABAP Report Events are used to handle different kinds of events during runtime. It starts with the event name, followed by the programming codes belonging to that event.
It is advisable to use Comment line to declare the end of an event, since Events do not have a closing Keyword and it ends as soon any other Event starts.
There are different kinds of events in ABAP, SAP has categorized these events together.
Categories of Events in ABAP:
There are three categories of Events in ABAP:
Event Category | Explanation | Events in the Category |
Program Constructor Events | Except Pool programs it occurs in every programs. | LOAD-OF-PROGRAM |
Reporting Events | These events occur only in Executable Reports. | INITIALIZATION START-OF-SELECTION END-OF-SELECTION (obsolete) |
Selection Screen Events | These events occur during Selection Screen Processing | AT SELECTION-SCREEN OUTPUT AT SELECTION-SCREEN |
List Events | These events occur during Classical List Processing [List can be a table or consecutive Write statements, etc.] | TOP-OF-PAGE END-OF-PAGE AT-LINE-SELECTION AT USER-COMMAND AT PFnn SET USER-COMMAND
|
Events in Classical Report:
Classical Reports have following events:
- LOAD-OF-PROGRAM : First event fired, loads program in memory
- INITIALIZATION: Initialize variable
- START-OF-SELECTION : Actual Business Logic (After START-OF-SELECTION)
- END-OF-SELECTION : To end above
- AT SELECTION-SCREEN : To validate Multiple Input fields (After Initialization and before START-OF-SELECTION) (After
- AT SELECTION-SCREEN OUTPUT: To manipulate Dynamic screen
- AT SELECTION-SCREEN ON
- AT SELECTION-SCREEN ON END OF
- AT SELECTION-SCREEN ON BLOCK
- AT SELECTION-SCREEN ON RADIOBUTTON GROUP
- AT SELECTION-SCREEN ON VALUE REQUEST
- TOP-OF-PAGE : To print heading
- END-OF-PAGE: To print footer
Programming Guidelines:
- Never use Selection Screen Events in Function Module
- Use LOAD-OF-SCREEN to load default values for the type of Reports executed via SUBMIT or using a transaction code
- Use INITIALIZATION to load default values for the executable type of Reports
- It is advised not to specify an event more than once [Except AT-SELECTION-SCREEN & GET event, all other can be specified multiple times.]
- If you are not specifying any event name, still specify START-OF-SELECTION to improve readability
- After every execution of events NEW-LINE event is executed automatically
Ref: https://www.gotothings.com/abap/what-are-classical-reports.htm
https://www.sapnuts.com/courses/core-abap/classical-reports/classical-report-events.html