1.

Explain about interfaces in SAP ABAP.

Answer»

Interface in SAP ABAP is an independent structure that is used when TWO similar classes have the same method name, but the functionalities of each will be different from each other. It looks similar to classes, but the method defined in an interface needs implementation in a CLASS for extending the scope of that class. Interfaces, as well as inheritance features, will provide a base for POLYMORPHISM, because a function defined in an interface may act differently in various classes.

Following is the SYNTAX for the creation of an interface:

INTERFACE <interfac_name>. DATA..... CLASS-DATA..... METHODS..... CLASS-METHODS..... ENDINTERFACE.

In the above given syntax, <interfac_name> stands for the interface name. The DATA and CLASS-DATA statements are used for instance and static interface attributes definition respectively. The METHODS and CLASS-METHODS statements are used for instance and static interface methods definition respectively. Here, the interface definition will not include the implementation class, so adding the DEFINITION clause in the interface declaration is not mandatory.



Discussion

No Comment Found