Ansicht
Dokumentation

ABENINTERFACE_ABEXA - INTERFACE ABEXA

ABENINTERFACE_ABEXA - INTERFACE ABEXA

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Interfaces

This example demonstrates the use of interfaces.

Source Code

Execute

Description

This example shows an interface status for displaying the attributes of an object and its implementation in two different classes.

The interface status contains a method write. The classes counter and bicycle implement the interface in the public area. Both classes must implement the interface method in the implementation part according to the required semantics.

First, two class reference variables count and bike are declared for the classes counter and bicycle. An interface reference variable status and an internal table status_tab with a suitable line type for the interface reference variable are created for the interface status. All reference variables begin with initial values.

Using the constructor operator NEW, an object is created for each class to which the references in count and bike point. Using the class reference variable, the methods increment and drive are called in the respective objects.

Class reference variables are inserted in the interface reference table to have the lines in status_tab point to the two objects as well. Using the interface references, it is possible to call the interface method write in the objects, but not the class methods increment or drive.






TXBHW - Original Tax Base Amount in Local Currency   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 1656 Date: 20240426 Time: 185037     sap01-206 ( 41 ms )