Show TOC

 Enhancing Classes with InterfacesLocate this document in the navigation structure

Use

Interfaces are extensions to class definitions and provide a uniform point of contact for objects. In contrast to classes, instances cannot be created from interfaces. Instead, classes implement interfaces by implementing all of their methods. Different classes can implement the same interface in different ways. Interfaces form the basis for polymorphism in ABAP Objects.

Prerequisites

The defining class and the interface already exist.

Procedure
  1. Open the defining class in editing mode.
  2. Choose the Interfaces tab page.
  3. Enter the required information.
  4. Choose the interface methods you want to implement in the class.
Result
  • You have enhanced the components of the class with interfaces. The added interfaces are listed in the definition part of the class following the INTERFACES statement in the class pool.
  • The methods listed in the interface definition can only be implemented within the class if they do not mark the interface as Abstract. To prevent naming conflicts, the components defined in the interface (attributes, methods, and events) appear in the class in the form:

    <interface name>~<component name>.