SAP Tech Pro | SAP Technical Blog for Tutorials and Code Snippets

SAP Tech Pro

SAP Technical Blog
Magzter [CPS] IN

Inheritance - Static attributes exist only once per inheritance tree

Static attributes only exist once in each inheritance tree. One can change them from outside the class using the class component selector with any class name, or within any class in which they are shared. They are visible in all classes in the inheritance tree.


Object Oriented Programming in ABAP - Dynamic Method Calls

One can call methods dynamically. Following restrictions apply:-

Name of the method can be dynamic for static/instance method.
Name of the class while calling static method can be dynamic.
Both the name of the static method and the class containing it can be dynamic.

While doing so, it is better to use uppercase to assign the name of the class/methods to the variables( which will be used for dynamic assignment) [More]

Object Oriented Programming in ABAP - Use of ME in methods

A method can have a variable defined within it having the same name as one of the attributes of the class to which the method belongs to.

To clearly identify the class level attribute, the selector ME is used.

Object Oriented ABAP - Use of RETURNING parameters in method

To get some values from a method , one can use the EXPORTING, CHANGING or RETURNING parameters.
If one uses RETURNING parameters, the following restrictions apply:-
(1) No EXPORTING/CHANGING parameters can be used for the method.
(2) Only one RETURNING parameter can be used.
(3) RETURNING parameters are only passed by value.

This program demonstrates the use of RETURNING parameters and the various ways to call a method with RETURNING parameter to get the value into some variable.

Object Oriented ABAP - Local Class can understand data and types in the global area of the program

This program will demonstrate the following :-

Different attributes of a class can be constructed utilizing the data and types declared outside the class, in the global area of the program.

Data declared in the global area of the program can be used directly in a class. [More]