ABAP objects can indicate that their state has changed by triggering a method. Events can be defined in classes or interfaces. Methods can trigger events with the RAISE EVENT statement. Each class (or interface) that is going to handle the corresponding event must implement a relevant handler method, and register it using the SET HANDLER statement. When an event occurs, the system calls all handler methods registered for that event.
Like method definitions, events have a parameter interface. The only difference is that events may only have EXPORTING parameters.
The class or interface already exists.
...
1. Open the class or interface in the Class Builder.
2. Choose the Events tab page.
3. To create an event, add the following entries:
Option |
Description |
Event |
Defines a unique name for the event |
Type |
The declaration type of an event sets whether the event is an instance event (for more information, see the ABAP Keyword documentation under EVENTS) or a static event (for more information, see the ABAP Keyword documentation under CLASS-EVENTS). |
Visibility |
Defines the visibility of the element using the Public, Protected, Package and Private options |
Description |
Short description of the event |
4. Save your entries.
● You have created events for your screen or interface. The events are listed in the declaration part of the class or interface after the EVENTS statement.
● You can further modify events by assigning them EXPORTING parameters. For more information, see Creating Parameters for Methods and Implementing Methods.
● For more information about event handling, see the ABAP keyword documentation under RAISE EVENT.
Creating Event Handler Methods