ABAP Keyword Documentation → ABAP - Reference → Declarations → Declaration Statements → Classes and Interfaces → ABAP Objects - Overview
Classes
The type of an object is known as its class. A class is an abstract representation of an object. Alternatively, it can be viewed as a set of instructions for building an object. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects.
Other versions: 7.31 | 7.40 | 7.54
Global and Local Classes
Classes can be defined globally in the class library in the repository or locally in an ABAP program.
Global classes are encoded 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. How they are used depends on the package check. Local classes can be used statically only in their own program. Dynamic access is also possible from other programs, although this is not recommended. When a global class is first used, the class pool is loaded to 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 a method of a local or global class is called. This is the reason why classes that are used by multiple programs should be created exclusively in the class library. Avoid reusing local classes by using include programs.