SAP INTERFACE DEFINITION ABAP Statements

Get Example source ABAP code based on a different SAP table
  



INTERFACE intf

Short Reference


ABAP Syntax INTERFACE intf [PUBLIC].

[components]
ENDINTERFACE.

ABAP Addition
... PUBLIC

What does it do? The statement block INTERFACE - ENDINTERFACE defines an interface intf. Naming conventions apply to the name intf. The components of the interface are declared between INTERFACE and ENDINTERFACE.



Latest notes:The definition of an interface can only be specifed in the
context described under INTERFACE.
• PUBLIC INTERFACE

ABAP Addition

What does it do? If you use the PUBLIC addition, the interface ifac becomes a global interface of the class library. The PUBLIC addition can only be used for the global interface of an interface pool and is generated by the Class Builder when a global interface is created.



Example ABAP Coding
In this example, an interface i1 is declared
using three interface components a1, m1, and e1. The class c1 implements the interface and the interface components therefore become public components of the class, which can be addressed using the interface component selector (~). INTERFACE i1.
DATA a1 TYPE string.
METHODS m1.
EVENTS e1 EXPORTING value(p1) TYPE string.
ENDINTERFACE.

CLASS c1 DEFINITION.
PUBLIC SECTION.
INTERFACES i1.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD i1~m1.
RAISE EVENT i1~e1 EXPORTING p1 = i1~a1.
ENDMETHOD.
ENDCLASS.

Return to menu