Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Classes and Interfaces →  Components in Classes and Interfaces →  Methods →  METHODS 

METHODS - ABSTRACT, FINAL

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


METHODS meth ABSTRACT|FINAL ... 

Extras

1. ... ABSTRACT
2. ... FINAL

Effect

The additions ABSTRACT and FINAL make an instance method abstract or final. They cannot be used in interfaces, only in classes. All instance methods can be declared as abstract except for instance constructors. The addition FINAL can be used in all variants of the statement METHODS.

Addition 1

... ABSTRACT

Effect

Uses the addition ABSTRACT to define an abstract method meth. The addition ABSTRACT is allowed only in abstract classes, not in interfaces. An abstract method is not implemented in the implementation section of its class. To implement an abstract method, it must be redefined in a specific subclass using the addition REDEFINITION.


Notes

  • Abstract methods can be defined in classes that are either abstract or final, but they can never be implemented and therefore are not usable.
  • Methods in interfaces are implicitly abstract, because interfaces do not contain method implementations.
  • With the exception of the instance constructor, concrete instance methods of a class can also call their abstract methods.
  • Static methods cannot be redefined and the addition ABSTRACT is not allowed in their declarations.

Addition 2

... FINAL

Effect

Uses the addition FINAL to define a final method meth. The addition FINAL is allowed only in classes, not in interfaces. A final method cannot be redefined in a subclass. In final classes, all methods are automatically final; the addition FINAL is not allowed. An instance constructor constructor is always final and FINAL can be specified but is not mandatory. Together with the addition REDEFINITION, the addition FINAL closes a path of an inheritance tree.


Note

Static methods cannot be redefined and the addition FINAL is not allowed in their declarations.