Skip to Content

What exactly are event blocks in ABAP and how are they different from methods in classes?

Does an event block run automatically or do you have to call it in the code?

I also wanted to know when exactly an event block terminates.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 09, 2019 at 08:15 AM

    It's all explained in the ABAP documentation of "Flow of an Executable Program".

    Difference with an OO event: the latter requires OO.

    When an event block terminates: when your code in this event block terminates.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 09, 2019 at 03:06 AM

    Hello Ikim SS,

    Before we get into details of the concepts let me answer your question:

    1) Does an event block run automatically or do you have to call it in the code?

    It is not mandatory to call an event in the report, if you do not mention any event in the report system implicitly calls the start of selection and executes. However it is good practice to handle the reports with events to have better control of the program

    2) I also wanted to know when exactly an event block terminates?

    Under each event you would have written specific lines of codes and these event will be called in a sequence which is explained below. Once all the code lines under each event is executed the event is finished. You can find out in example programs how the events are called, they would have just mentioned the name of the event in the program and written code lines below that. All the code written below an event belong to that event.

    3) How are ABAP EVENTS different from METHODS in CLASSES?

    Well these two are different concepts, to keep things simple in ABAP the events and sequence are all already defined. They are introduced to have a control over the flow of program ,You do not have any option to change to sequence of these events.

    Methods in Classes are defined by us and only we decide when to call the methods based on the business requirement.

    Methods are basically the business functionality wrapped in a box and ABAP events are the predefined sequence for the report to execute.

    You can get more clarity when you read the concepts in detail.


    ABAP is called as the procedural Language hence the design of the language is built in such a way that all the program executes in certain sequence.

    Event Blocks in ABAP helps us to control the program through sequence in which the program runs, There are different event blocks triggered at different junction of the program and you Just need to mention the Name of the event in the program to trigger it. Each events help us to perform one functionality. For example there is an event called INITIALIZATION, this is the first event that is called when the program is executed. This event helps us assign the default values to the variables of the program. There is another event called AT SELECTION SCREEN, this event helps us to validate the Inputs entered in selection screen and this is called when we proceed from the selection screen after giving inputs.

    All the Code lines written under each event will be executed when the event is called. Events vary for different types of reports as given below:

    Events In Classical Reports.

    INTIALIZATION: This event triggers before selection screen display.

    AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.

    START OF SELECTION: Start of selection screen triggers after proceesing selection screen.

    END-OF-SELECTION : It is for Logical Database Reporting.

    Interactive Report Events:

    AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.

    AT PFn: For predefined function keys...

    AT USER-COMMAND : It provides user functions keys.

    TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.

    Selection screen alone has a number of events, you can follow the below Blog for the same.


    Sample program with events used, look for the Events and how are they declared.


    In case you are confused with OOPS Events please note that they are entirely different concept, you can go through the details in below Blog.


    This is just for starting up, you can explore more to get more details.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.