SAP ABAP Object Events - SAP ABAP

What are object events in sap abap?

An event acts as a good communicator between the objects. It is the process by which method of one class can raise the method of another class. When an event is triggered, you can raise any number of event handler methods. The link between a trigger and its handler method is actually decided dynamically at run-time.

When the user uses a normal method call, then the program decides to which method of an object or a class needs to be called. As for every event, fixed handler method is not registered. The other handler method helps in determining the event that has to be triggered.

By using the RAISE EVENT statement, an event of a class can trigger an event handler method of the same class. FOR event class is used to define the event handler method in the same class of different class.

The following syntax is as follows:

An event can hold parameter interface which contains only output parameters. These output parameters are passed to the event handler method by the RAISE EVENT statement and later on it receives as input parameters. An event is linked to its handler method dynamically in a program by using the SET HANDLER statement.

When an event is triggered, accurate event handler methods are supposed to be executed in all the handling classes.


The above code produces the following output −

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status