ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Classes and Interfaces
INTERFACE
Other versions: 7.31 | 7.40 | 7.54
Syntax Forms
Declaration of Interfaces
1. INTERFACE intf [PUBLIC].
[components]
ENDINTERFACE.
Deferred Interfaces
2. INTERFACE intf DEFERRED [PUBLIC].
Effect
The statement INTERFACE
defines interfaces or defers them.
-
The definition of an interface consists of a declaration
section that starts with
INTERFACE
and is ended usingENDINTERFACE
. Unlike classes, an interface does not have an implementation part. -
Additional variants of
INTERFACE
withoutENDINTERFACE
are used for deferring interfaces in a program.
The statements INTERFACE
and associated statements ENDINTERFACE
can be specified only in the global context of a program. INTERFACE
and
ENDINTERFACE cannot be specified within classes, procedures, and processing blocks implemented
internally as a procedure (namely event blocks for GET
and AT SELECTION-SCREEN
)
. This applies in particular to the variant of INTERFACE
specified here, which is not closed using ENDINTERFACE
.
Notes
-
The definition or deferral of an interface is handled like other declaration statements
(
DATA
,TYPE
, ...). In a processing block without a local context, they are handled like global program declarations and do not end the processing block. -
Previously, an obsolete variant
INTERFACE ... LOAD
was used to load interfaces explicitly.