Show TOC

 Creating EventsLocate this document in the navigation structure

Use

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.

Prerequisites

The class or interface already exists.

Procedure
  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.
Result
  • 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.

See also:

Creating Event Handler Methods