Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Classes and Interfaces →  Components in Classes and Interfaces →  Events 

CLASS-EVENTS

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


CLASS-EVENTS evt [EXPORTING parameters] . 

Addition

... EXPORTING parameters

Effect

This statement declares a static event evt in a class or interface. The naming conventions apply to the name evt. Using the statement RAISE EVENT, the static event evt can be raised in all methods of the same class or of a class that implements the interface, as well as in the methods of subclasses (if it is visible here).


Note

Event handlers declared for a static event inherited from a superclass can only respond to this event if it is raised by a method of the subclass or one of its subclasses. If the event is raised in a static method of a superclass, it is not handled, even if the method is called in a subclass or if the name of the subclass is specified.

Addition

... EXPORTING parameters

Effect

The addition EXPORTING defines the parameter interface of the event evt. The syntax and meaning of the additions parameters are the same as in the definition of instance events using the statement EVENTS.


Note

Static events do not have the implicit formal parameter sender.


Example

Declares static events in the class CL_ABAP_BROWSER.

CLASS cl_abap_browser DEFINITION
  ...
  PUBLIC SECTION.
    ...
    CLASS-EVENTS
      sapevent
        EXPORTING
          VALUE(action) TYPE string
          VALUE(query_table) TYPE cnht_query_table OPTIONAL.
    CLASS-EVENTS
      closed.
    ...
ENDCLASS.

Executable Example

Events in Inheritance