ABAPINTERFACES_IFAC - INTERFACES IFAC
SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up BAL Application Log DocumentationThis documentation is copyright by SAP AG.
INTERFACES intf
Syntax
INTERFACES intf.
Effect
Within the declaration of an interface, the INTERFACES statement integrates interface intfin the declared interface. You cannot specify an additions. As a result, interface intf becomesa component interface of a composite interface. An interface can be composed of any number of differentcomponent interfaces. All these interfaces are equally valid on one level. If a component interfaceitself is a composite - that is, it contains its own component interfaces - the nesting hierarchy is irrelevant for the composition of the interface. It is relevant, however, for accssing the interface components.
To access a component comp of a component interface intf within a composite interface,you can use the expression intf~comp with the interface component selector (~). Multipleuse of the interace component selection in an identifier (such as intf1~intf2~comp) is generallynot supported. Within a composite interface, you can use the interface component selector to accessonly interface components of the component interface that are integrated in this interface using thestatement INTERFACES. If you want to access components in a composite interface that cannot be addressed through the one-time use of the interface component selector, you must use theALIASES statement to declare alias names for the interface components.Notes
- Each interface and its components appear only once in a composite interface. Even an interface thatis seemingly implemented several times in an interface, because it is an interface component of one or more other interfaces, really exists only once.
Since there are no separate namespaces for global and local interfaces, you have to make sure thatcompositions of local interfaces do not result in combinations of global and local interfaces with identical names, because they cannot be equally valid on the same level in their implementation.
Example
The following example illustrates how you can use the INTERFACES statement to compose and implementinterfaces. Class c1 implements the composite interfaces i2 and i3. Although itis a component interface of i2 and i3, it exists only once in class c1. A referencevariables iref1 of the static type i1 is used to generate an object class c1 and call method i1~m1, which is implemented there.
INTERFACE i1.
METHODS m1.
ENDINTERFACE.
INTERFACE i2.
INTERFACES i1.
METHODS m2.
ENDINTERFACE.
INTERFACE i3.
INTERFACES i1.
METHODS m3.
ENDINTERFACE.
CLASS c1 DEFINITION.
PUBLIC SECTION.
INTERFACES: i2, i3.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD i1~m1.
...
ENDMETHOD.
METHOD i2~m2.
...
ENDMETHOD.
METHOD i3~m3.
...
ENDMETHOD.
ENDCLASS.
DATA iref1 TYPE REF TO i1.
START-OF-SELECTION.
CREATE OBJECT iref1 TYPE c1.
iref1->m1( ).
General Material Data ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 3753 Date: 20120522 Time: 234411 triton ( 159 ms )






