Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts →  Classes and Interfaces →  ABAP Objects - Overview 

Classes

The type of an object is known as its class. A class is an abstract representation, or, metaphorically speaking, a set of instructions for building objects. So that you can describe the properties of objects, classes contain components, which define the state and behavior of objects.

Other versions: 7.31 | 7.40 | 7.54

Global and Local Classes

You can define classes globally in the class library in the repository or locally in an ABAP program.

Global classes are coded in a special ABAP program, a Class-Pool, whereas local classes can be coded in almost every ABAP program. Global classes are visible in all ABAP programs. The usablity depends on the package check. Local classes can only be used statically in their own program. Dynamic accesses are also possible across program limits but it is not recommended. When a global class is used for the first time, the class pool is loaded into the internal session of the user. The local classes of a class pool can be used by the pool's global classes.

Except for the storage type and the visibility, there are hardly any conceptual differences between global and local classes. One of the few differences is that in the public interface of a global class only references to public types are possible. These types are subdivided into global and local friends.

In principle, it also does not make any difference if you call a method of a local or global class. This is the reason why classes that are used by several programs are exclusively created in the class library. You should avoid, if possible, to reuse local classes using include programs.

Continue

Components of Classes