Posts

Showing posts from February, 2024

Global multiple inheritance using parameters.

Image
* Multiple inheritance is possible through interfaces. Steps to create global interfaces.  Create interface 1.      1. Goto T-code  SE24 .       2. Give  name  and click on create, select  interface  and press enter.       3. Give  description,  Press enter.      4. Give  method name, level, description.       5.  Save  and  activate.      6. Click on  parameters  and give parameters.           7.  Save  and  activate  and go back. Create interface 2.      1. Goto T-code  SE24 .      2. Give  name  and click on create, select  interface  and press enter.      3. Give  description,  Press enter.       4. Give  method name, level, description.        5.  Save  and  activate.     6. Click on  parameters  and give parameters.           7.  Save  and  activate  and go back. Create class for 2 interfaces.      1. Goto  SE24.      2. Give  class name  and click on  create  and  give short description  and click on save.           3. Goto interface tab and give interfaces and press enter.   

Differences between Abstract class and interfaces

  Abstract classes:       *  In Abstract class have at least one abstract method and others can non-abstract methods.        *  Abstract methods can be public, private or protected.        *  We need to redefine the abstract method to implement the method in sub class. we cannot redefine static methods.        * Multiple inheritance is not possible. Interface:     *  All methods are abstract methods in interfaces.     *  All methods are public.     *  No need to redefine method. we can write the code by clicking on source code button.     * Multiple inheritance is possible. ************************ Thank you  ************************

Local interface with example using parameters.

Image
  1. Goto  SE38. 2. Give  program  name and click on  create. 3. Give  description  and select type  executable program . 4. Write  code. REPORT  zab_if_sale_delivery . DATA :  lv_erzet  TYPE  erzet ,       lv_erdat  TYPE  erdat ,       lv_vbtyp  TYPE  vbtyp ,       lv_ernam  TYPE  ernam . PARAMETERS :  p_vbeln  TYPE  vbeln . PARAMETERS :  p_r1  TYPE  c  RADIOBUTTON  GROUP  g1 ,             p_r2  TYPE  c  RADIOBUTTON  GROUP  g1 . INTERFACE   if_sale_del .    METHODS  display      IMPORTING  pvbeln  TYPE  vbeln      EXPORTING  perzet  TYPE  erzet               perdat  TYPE  erdat               pvbtyp  TYPE  vbtyp               pernam  TYPE  ernam . ENDINTERFACE . CLASS   sale  DEFINITION .    PUBLIC  SECTION .      INTERFACES  if_sale_del . ENDCLASS . CLASS   sale  IMPLEMENTATION .    METHOD  if_sale_del ~ display .      SELECT  SINGLE  erzet             erdat             vbtyp             ernam              FROM  vbak              INTO  (  perzet , perdat ,  pvbtyp ,  pernam  )