ABAP INTERFACES in Objects

INTERFACES statement is used in ABAP Objects programming development. We can declare interfaces globally or locally in our ABAP programs. Interface will contain only declaration parts; it won’t contain any executable statements. We can declare all the components like attributes, methods, types etc in an Interface. In the definition part of a Class the declared interfaces will be listed. In the methods of class, all the operations in interfaces will be defined and it should present in the class implementation part.

All the declared components will be available automatically in the class.

INTERFACE statement Syntax

INTERFACE <ifac> [DEFERRED] [LOAD]

……

ENDINTERFACE.

  • INTERFACE is the statement to declare and interface in ABAP objects. After the declaration it should close with ENDINTERFACE.
  • DEFERRED addition declares the interface before it is actually defined.
  • LOAD addition is used for loading an already declared interface from the class library.

 

INTERFACES statement syntax

INTERFACES <ifac>

[ABSTRACT|FINAL METHODS <meth1> <meth 2> | ALL METHODS ABSTRACT|FINAL ]

[DATA VALUES <attr1> = <val 1> <attr 2> = <val 2> …]

  • INTERFACES is the statement used to list the declared interface in a class declaration part.

You will get clearer picture after by seeing the following sample ABAP program with Interfaces and Class.

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes