ABAP Keyword Documentation → ABAP - Reference → Declarations → Declaration Statements → Classes and Interfaces
Other versions: 7.31 | 7.40 | 7.54
Declaration Part of a Class
1. CLASS class DEFINITION [class_options].
Implementation Part of a Class
CLASS class IMPLEMENTATION.
Publication of Classes
CLASS class DEFINITION DEFERRED [PUBLIC].
Local Friends of Global Classes
4. CLASS class DEFINITION
LOCAL FRIENDS class1 class2 ...
intf1 intf2 ...
CLASS defines a class
class, publishes it, or specifies properties.
The complete definition of a class consists of a declaration part and an
implementation part, which are both introduced
CLASSand ended by
ENDCLASS. In the declaration part, the properties of the class are specified and its components are declared. In the implementation part, the methods of the class are implemented.
The variants of
ENDCLASSare used for the publication of classes in a program and the declaration of local friends of a global class.
CLASS and associated statements
can be specified only in the global context of a program.
ENDCLASS cannot be specified within classes, procedures, and processing blocks implemented internally
as a procedure (event blocks for
This applies in particular to the variants of
CLASS specified here, which is not closed using
The declaration part of a class, and the variants of
CLASSnot closed using
ENDCLASSare handled like other declaration statements (
TYPE, ...). In a processing block without a local context, they are handled like global program declarations and do not end the processing block.
- Overall, the implementation part of a class functions like a separate processing block and closes other processing blocks.
The obsolete variant
CLASS ... DEFINITION LOADwas formerly used to load classes explicitly.