GoodleAds

OOPS ABAP- INTERFACE



                                       INTERFACE

1. Interfaces are independent structure which is used in a class to extend the functionality of a class.
2. It contains collection of methods without any implementation.
3. Where as a class contains methods with implementation.
4. We need to specify an interface with the required method  names in SE24 TCODE.
5. Now, this interface can be used by ‘n’ no of classes to extend the functionality of the class.
6. Just give the name of interface under the ‘interface’ tab.
7. All the interface methods will be automatically copied to the classes in a particular class without affecting the other classes.

Polymorphism

Polymorphism is a concept by which the same method names will behave differently in different classes i.e. each method will have its own implementation in different classes but with the same name.

EXAMPLE ON INTERFACE

        Go to SE24 provide interface name.

        Interface name should start with ZIF.



 



        Define the method name.





        Provide Parameters





        Save it and activate it.
        We cannot implement the method of this interface.
        Provide the name in the class Tcode SE24.

 



9. SAVE IT..

10. Now go to Methods Tab then we can see the interface method in the class method.