Show TOC

 Nesting InterfacesLocate this document in the navigation structure

Use

ABAP Objects supports nested or compound interfaces. A compound interface contains one or more interfaces as component interfaces. These component interfaces may contain further interfaces as components. Several levels of nesting are possible.

Prerequisites

All of the component interfaces must already exist in the class library.

Procedure
  1. In the Class Builder, choose Interfaces for the relevant interface.
  2. Under Includes, enter the names of the component interfaces.

    If you select the Only modeled option, the system does not create a corresponding entry in the class pool.

  3. Press Enter.

    The system adds the entry in the class library.

  4. Save your entries.
Result

All of the component interfaces that you entered belong to the same nesting level. When a class uses a compound interface, it must implement all methods of all component interfaces.

All the interfaces involved are implemented at the same level irrespective of their nesting hierarchy. You can access their components using their original names in the form:

<Interface name>~<component>

Tip

You can assign all the components of the interfaces alias names serving as abbreviations for their full names. To do so, choose Aliases and enter the alias name. In addition to the name, you can also define the visibility (PUBLIC, PROTECTED, PRIVATE) and thus restrict the use of alias names.