SAP Tutorials Blog



INTERFACE interface1.

  METHODS method1.

ENDINTERFACE.                                               "interface1


*----------------------------------------------------------------------*

*       INTERFACE interface2

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

INTERFACE interface2.

  METHODS: method1, method2.

  INTERFACES interface1.

  ALIASES int1_method1 FOR interface1~method1.

ENDINTERFACE.                                               "interface2


*----------------------------------------------------------------------*

*       CLASS class1 DEFINITION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS class1 DEFINITION.

  PUBLIC SECTION.

    INTERFACES interface2.

    ALIASES int2_method2 FOR interface2~method2.

ENDCLASS.                    "class1 DEFINITION


*----------------------------------------------------------------------*

*       CLASS class1 IMPLEMENTATION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS class1 IMPLEMENTATION.

  METHOD interface1~method1.

    WRITE:/ 'this is a method from interface1' COLOR 5.

  ENDMETHOD.                    "interface1~method1


  METHOD interface2~method1.

    WRITE:/ 'this is a method from interface2' COLOR 6.

  ENDMETHOD.                    "interface2~method1


  METHOD interface2~method2.

    WRITE:/ 'this is a method from interface2' COLOR 7.

  ENDMETHOD.                    "interface2~method2


ENDCLASS.                    "class1 IMPLEMENTATION


START-OF-SELECTION.


  DATA: object1 TYPE REF TO class1.


  CREATE OBJECT object1.


  CALL METHOD: object1->interface2~int1_method1,

               object1->interface2~method1,

               object1->int2_method2.


 

Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com