Global abstract class with example using parameters.

* A class which contain at least one or more than one abstract method then it's called as Abstract class. 

* Abstract method is the method which has only definition but not be any implementation.

* We cannot create object for abstract class.

* We can create objects for sub class of abstract class.

Steps to create abstract class in SE24.

1. Goto T-code SE24.

2. Give name and click on create, select class and press enter

3. Give description and select generation abstract and uncheck the final. Press enter.


4. Give method name, level, visibility, description.


5. Click on parameters and give parameters.


6. Save and activate and go back.

7. Click on 'go to properties', Select abstract, select ok and click on change.


8. Save and activate the class.

9. Create a sub class.

    * Goto T-code SE24.

    * Give name, Press enter, select class and press enter.

    * Give description and press enter.

    

    * Goto properties and click on super class and give super class name.

 

    * Check and activate.

    * An error will come. click on redefine method and write logic.


            METHOD display.

            SELECT SINGLE erzet
                          erdat
                          vbtyp
                          ernam
                          FROM vbak
                       INTO perzet,perdatpvbtyppernam )
                       WHERE vbeln EQ pvbeln.
       ENDMETHOD.
    * Save and activate the class.
   * Execute.
      Input


    Output



10. Create another sub class (Repeat step 9).
    * Write logic.
        METHOD DISPLAY.
            SELECT SINGLE erzet
                        erdat
                        vbtyp
                        ernam
                        FROM likp
                       INTO perzet,perdatpvbtyppernam )
                        WHERE vbeln EQ pvbeln.
        ENDMETHOD.
    * Execute.
    Input
       

    Output
          

******************Thank you****************

Comments

Popular posts from this blog

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).

Concatenation new syntax( 7.4+ ).