Ansicht
Dokumentation

ABAPCLASS_IMPLEMENTATION - CLASS IMPLEMENTATION

ABAPCLASS_IMPLEMENTATION - CLASS IMPLEMENTATION

CPI1466 during Backup   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

CLASS, IMPLEMENTATION

Short Reference



CLASS class IMPLEMENTATION.
  ...
  METHOD ...
    ...
  ENDMETHOD.
  ...
ENDCLASS.

Effect

In the statement block CLASS class IMPLEMENTATION - ENDCLASS, the following methods of a class class must be implemented, in any order:

  • All concrete methods of interfaces listed using the statement INTERFACES in the declaration part of the class.
  • All methods inherited from superclasses that are listed using 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. In a method implementation, all components can be accessed in an instance method, and all static components of the class can be accessed in a static method implementation. No component selector is necessary to address the components of personal classes. Within the implementation of each instance method, there is an implicitly created, local reference variable named me available at runtime, which points to the current instance of the method.

When implementing methods declared in an interface bound by the class using 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 occurs when local interfaces are used. If a global interface is specified using intf~, only a syntax warning occurs. 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.

Notes

  • A class that does not have to implement any methods because 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.

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.






Fill RESBD Structure from EBP Component Structure   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 3634 Date: 20240420 Time: 130803     sap01-206 ( 67 ms )