Ansicht
Dokumentation

ABENEVENT_INHERITANCE_ABEXA - EVENT INHERITANCE ABEXA

ABENEVENT_INHERITANCE_ABEXA - EVENT INHERITANCE ABEXA

BAL Application Log Documentation   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

- Events in Inheritance

This example demonstrates the behavior of events in inheritance.

Source Code

Execute

Description

A static event ce1 and an instance event ie1 are declared in a superclass c1. The superclass c1, its subclass c2, and its subclass c3 each contain a static method and an instance method for raising the events.

In the class c4, event handlers are declared in c2 for the events inherited from c1. The method main of the class event_demo registers the events and calls all methods that can raise events, whereby different options are used to address the methods. An "X" is displayed after the method call for a handled event.

  • The event handler cm4 declared for the class c2 can only handle events that are raised in this class or in its subclass. Events that are raised by the static method cm1 in c1 are not handled, regardless of the class name specified for the call (see also Inheritance and Static Components).
  • The event handler im4 declared for the class c2 can also only handle events raised in this class or in its subclass. Unlike when calling static methods, the class of the object is always addressed when addressing an object using an object reference and raised events in the inherited method im1 of the classes c2 and c3 are handled.





General Data in Customer Master   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 1787 Date: 20240423 Time: 215116     sap01-206 ( 38 ms )