SAP® Documentation

Single view

ABAPEVENTS - EVENTS

BAL Application Log Documentation   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

EVENTS

Short Reference



Syntax

EVENTS evt $[EXPORTING parameters$].

Addition:

... EXPORTING parameters

Effect

Declares an instance event evt in a class or interface. The Naming conventions apply to the name evt. Using the statement RAISE EVENT, the instance event evt can be raised in any instance method of the same class, or of any class that implements the interface, as well as in the instance methods of subclasses (if they are visible there).

Addition

... EXPORTING parameters

Effect

The addition EXPORTING defines the parameter interface of the event evt. An event can only have output parameters parameters that are passed by value.

When an event handler is declared using the addition FOR EVENT OF of the statement METHODS or CLASS-METHODS, the output parameters of the event are defined as the input parameters of the event handler. The properties of the input parameters are applied from the output parameters defined in EVENTS.

As well as the output parameters defined explicitly using EXPORTING, each instance event has an implicit output parameter, sender. This output parameter has the type reference variable. When the event is raised using RAISE EVENT, the reference to the raising object is implicitly assigned to sender.

The static type of the input parameter sender is defined for every event handler by the object type (class or interface) that is specified after the addition FOR EVENT OF of the statement METHODS or CLASS-METHODS.

Note

The dynamic type of the implicit formal parameter sender is always the class of the object in which the event is raised.

Example

In the interface window, three events are declared, each with an explicit non-optional output parameter status. The class dialog_window implements the interface window. The interface window_handler contains event handlers, which import both the explicit parameters and the implicit parameter sender. The static type of the input parameter sender is the class dialog_window.

INTERFACE window.
  EVENTS: minimize EXPORTING VALUE(status) TYPE i,
          maximize EXPORTING VALUE(status) TYPE i,
          restore  EXPORTING VALUE(status) TYPE i.
ENDINTERFACE.

CLASS dialog_window DEFINITION.
  PUBLIC SECTION.
    INTERFACES window.
ENDCLASS.

INTERFACE window_handler.
  METHODS: minimize_window
             FOR EVENT window~minimize OF dialog_window
             IMPORTING status sender,
           maximize_window
             FOR EVENT window~maximize OF dialog_window
             IMPORTING status sender,
           restore
             FOR EVENT window~restore OF dialog_window
             IMPORTING status sender.
ENDINTERFACE.

Events in Inheritance






Vendor Master (General Section)   General Material Data  
This documentation is copyright by SAP AG.

Length: 5323 Date: 20200125 Time: 091246     sap01-206 ( 65 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.