Show TOC Entering content frame

Procedure documentation Creating Events Locate the document in its SAP Library structure

ABAP Objects can indicate that their state has changed by triggering a method. Events can be defined in classes or in interfaces. Corresponding methods can trigger these 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 of the 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.

Prerequisites

You must already have created the class or interface.

Procedure

...

       1.      Select the class or interface and change to the Class Editor.

       2.      Choose Events.

       3.      To create an event, make the following entries:

- Event
Define a unique name with which the event is identified.

- Type
Specify events with an instance event as instance event or with static event as static event.

- Visibility
Define the event’s visibility using Public, Protected and Private.

- Modeled only
If the flag is set, no entry will be made in the class pool. You cannot access the components at runtime.

- Description
Short description of the event.

       4.      Repeat the above steps for any further events. Example:




This graphic is explained in the accompanying text

       5.      Save your entries.

Result

You have now created events for your object type. The events are listed in the declaration part of the class or interface after the EVENTS statement.

You can specify events further by giving them EXPORTING parameters. You can find the procedure under Creating Parameters and Exceptions and under Implementing Methods.

You can find more information about event handling with OO ABAP in the keyword documentation for example for the RAISE EVENT statement.

See also:

Creating Event Handler Methods

 

 

Leaving content frame