CLASS - IMPLEMENTATION
Short Reference
ABAP Syntax CLASS class IMPLEMENTATION.
...
METHOD ...
...
ENDMETHOD.
...
ENDCLASS.
What does it do? In the statement block
CLASS class IMPLEMENTATION -
ENDCLASS , the following methods of a class class must be
implemented, in any order:
All concrete methods that are declared
using METHODS or
CLASS-METHODS in the declaration part of the class.
All concrete methods of interfaces that are listed by the statement
INTERFACES in the declaration part of the
class.
All methods inherited from superclasses that are listed by the
statement METHODS ... REDEFINITION
in the declaration part of the class.
The implementation of each method corresponds to a processing block
METHOD - ENDMETHOD . No statements are allowed
in the implementation part outside of method implementations. All
components of the class can be accessed in an instance method
implementation. All static components of the class can be accessed in a
static method implementation. You do not need a component selector to
address the component of your own class. Within the implementation of
each instance method, there is an implicitly created, local reference
variable named me available at runtime. It points to the current
instance of the method.
When implementing methods declared in an interface bound by the class
INTERFACES intf , the name of the
method in METHOD must have either intf~ in front of it or
use an alias name declared using ALIASES . The
interface method must be declared in the interface. Otherwise, a syntax
error will occur when local interfaces are used. If you specify a global
interface using intf~ , only a syntax warning is issued. In this
way, the classes remain usable even after subsequent removal of the
methods from the global interface, provided they have not used the
methods themselves.
Latest notes: A class that does not need to implement any methods on the
basis of its declaration part either has an empty implementation part or
none at all.
Abstract methods in abstract classes cannot be implemented in the
implementation part.
The implementation part of a class can only be specified in the
context described under CLASS .
Example ABAP Coding In this example, three methods of the class c2
must be implemented. The method m1 in c1 is abstract and
must not be implemented there.
INTERFACE i1.
METHODS m1.
ENDINTERFACE.
CLASS c1 DEFINITION ABSTRACT.
PROTECTED SECTION.
METHODS m1 ABSTRACT.
ENDCLASS.
CLASS c2 DEFINITION INHERITING FROM c1.
PUBLIC SECTION.
INTERFACES i1.
METHODS m2.
PROTECTED SECTION.
METHODS m1 REDEFINITION.
ENDCLASS.
CLASS c2 IMPLEMENTATION.
METHOD m1.
...
ENDMETHOD.
METHOD m2.
...
ENDMETHOD.
METHOD i1~m1.
...
ENDMETHOD.
ENDCLASS.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved