Between the statements
ENDMETHOD, the function of a
meth declared using
is implemented in a class. The implementation of a method is only possible in an implementation part
of a class that begins with
CLASS class IMPLEMENTATION
Local data types and data objects can be declared within the method. It is also possible to access the formal parameters of the method and all the components of all instances of its own class.
In instance methods, all components of the class of the method and the instance of the method can also be addressed explicitly using the self reference me->, as well as using their names. In addition, all components of other instances from the class of the method can be addressed using reference variables.
When a method of an interface
methcan be specified either as the name declared in the interface (prefixed with
intf~) or as an alias name of the class defined using
ALIASES. The method must exist in the interface. If not, a syntax error occurs. If
intf~is used, only a syntax warning appears for global interfaces, so that classes are not immediately rendered invalid if an unused method is deleted from a global interface.
The addition BY
DATABASE PROCEDURE transforms a method implemented in a database-specific language (and not in ABAP) and executed in the database system to an
In this example, the two methods
are implemented. Although the local data object
a1 obscures the attribute of the same name, the attribute
a1 can be addressed using
CLASS c1 DEFINITION. PUBLIC SECTION. METHODS m1 IMPORTING p1 TYPE string. PRIVATE SECTION. DATA a1 TYPE string. METHODS m2. ENDCLASS. CLASS c1 IMPLEMENTATION. METHOD m1. a1 = p1. m2( ). ENDMETHOD. METHOD m2. DATA a1 TYPE string. a1 = me->a1. ENDMETHOD. ENDCLASS.