ABAP Refactoring - Local Class to Global Class


In abap it is possible to create both local classes, defined within an ABAP program, or create them in the repository, via the ABAP Class Builder ( SE24 or SE80). The difference being that the global class can be used in several reports, and the local class can only be used within the ABAP program it was created in.

Then, if you are creating program specific logic, you can use the a local class. One example of local classes are the one used to Unit Test a program, or function module, or local class. 
Note that with global classes you should use the ABAP UNIT TEST framework, which is another reason that makes working with global classes so compelling.

But sometimes we realize that a class created a a local class would be useful on another context, thus we should change the class from local to global, so that it can be used in that new context. fortunately the ABAP Class builder provides a very useful re-factoring tool to convert a local class to a global one.

This is how to do it.

  • SE24->Object type->Import->Local Classes in program






  • Select the program and class to be converted to the ABAP repository, and press the import button.





  • The class is created in the ABAP repository, and now the programs should be changed to use this instead of the old local class. 


Note: This method does not delete the old local class, only creates a duplicate in the ABAP repository. It is a good practice to remove the local class from the program because it will be no longer used.

4 comments:

  1. this is very good nice article. this is very useful for ORACLE OAF students.


    ==========================================================
    This is very nice article. This is very use ful for oracle OAF Learners.
    http://www.itglobaltrainings.com/oracle-oaf-online-training/
    ===========================================================

    hi sir. i want to do ORACLE OAF training.
    oracle OAf ONlINE TRAINING

    ReplyDelete
  2. this is very good nice article. this is very useful for ORACLE atg commerce students.


    ==========================================================
    This is very nice article. This is very use ful for oracle atg commerce Learners.
    http://www.itglobaltrainings.com/oracle-atg-commerce-online-training/
    ===========================================================

    hi sir. i want to do ORACLE OAF training.
    oracle atg commerce ONlINE TRAINING

    ReplyDelete
  3. Trainingindians is the one institutes for providing SAP ABAP Training .
    they good real time faulty
    http://www.trainingindians.com/sap-abap-online-training/

    ReplyDelete
  4. Hey it was really a nice article and i was really impressed by reading this article about Sap Online Training, In USA catminds online training also provide the best Software Courses Online Training with an experienced faculty.

    ReplyDelete