ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Classes and Interfaces → ABAP Objects - Overview → Statements in ABAP Objects
Statements for Defining Classes and Interfaces
The following statements are used to define classes and interfaces and their components. They can be used in any ABAP program where class and interface definitions are allowed.
Other versions: 7.31 | 7.40 | 7.54
Statements for Defining Classes
Defining the Declaration Part
CLASS ... DEFINITION ...
...
ENDCLASS ...
Defining the Implementation Part
CLASS ... IMPLEMENTATION ...
...
ENDCLASS ...
Statements for Defining Components of Classes
Statements in the Declaration Part
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES ...
INTERFACES ...
ALIASES ...
CONSTANTS ...
CLASS-DATA ...
DATA ...
CLASS-METHODS ...
METHODS ...
CLASS-EVENTS ...
EVENTS ...
Statements in the Implementation Part
METHOD ...
...
ENDMETHOD.
Statements for Defining Interfaces
Declaring the Interface
INTERFACE ...
...
ENDINTERFACE ...
Statements for Declaring Components of Interfaces
The same statements can be used to declare both components in interfaces as in the declaration part of classes.
Note
The components of classes or interfaces (their attributes, methods, and events) are declared in their
declaration parts. TYPES
can also be used to declare local data types.
ALIASES can be used to declare alias names for the components of implemented interfaces. In a class, all declarations must belong to one of the four
visibility sections introduced by the relevant statements.
The implementation part of a class can only contain method implementations between METHOD - ENDMETHOD
blocks. In methods, only the
statements for method implementations can be used.
No
The stricter syntax in ABAP Objects applies to all class and interface definitions.