SAP Tech Pro

SAP Technical Blog
Magzter [CPS] IN

Object Oriented Programming in ABAP - Events with export parameters

Events can have export parameters, which it passes to its event handler method. The triggering method must pass values for all the exporting parameters of the event while raising the event using RAISE EVENT statement. The interface of an event handler method consists of a list of IMPORTING parameter... [More]

Object Oriented Programming in ABAP - Friendship between Classes

A class can grant friendship to another class. By granting friendship , it allows another class to:-
Use its private components.
Instantiate it, irrespective of the CREATE PRIVATE addition. [More]

Object Oriented Programming in ABAP - Polymorphism via Interfaces

This program will demonstrate how a method of an interface can be interpreted differently in different classes. At runtime, one can use different class reference variables to call same method of the interface to have different things done.
Use of interface reference variable in this context further simplifies the work. [More]

Method of a parent class, used from its subclass, uses attributes of the parent class only, if the method is not re-defined in subclass.

As long as a method (using private attributes) inherited from a superclass is not redefined, it still uses the private attributes of the superclass, not those of the subclass, even if the subclass has private attributes of the same name. [More]

Object Oriented Programming in ABAP - Static constructor of a class is called only once per program.

The first when a subclass in a program is accessed, its static constructor is executed. But, before it can be executed, the static constructors of all of its superclasses must already have been executed. A static constructor may only be called once per program. Therefore, when one first address a subclass, the system looks for the next-highest superclass whose static constructor has not yet been executed. It executes the static constructor of that class, followed by those of all classes between that class and the subclass that is addressed. [More]