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.

7 thoughts on “ABAP Refactoring – Local Class to Global Class

  1. I am Sridevi Koduru, Senior Oracle Apps Trainer at Oracleappstechnical.com With 8 Yrs Exp on Oracle Apps and 13 Yrs IT Exp Providing Online Training on Oracle Apps Technical, Oracle Apps Financial Functional, Oracle Apps SCM, Oracle Apps HRMS, Oracle Financial for Indian Localization, SQL, PL/SQL and D2K. I have Provided Training for 500+ Professionals Most of them are Working in Real Time now.

    Contact for (One to One Personal Online Training) on Oracle Apps Technical, Oracle Apps Financial Functional, Oracle Apps SCM, Oracle Apps HRMS, Oracle Financial for Indian Localization, SQL, PL/SQL and D2K at training@oracleappstechnical.com | sridevikoduru@oracleappstechnical.com | +91-9581017828 | http://www.oracleappstechnical.com

    Linkedin profile – http://in.linkedin.com/pub/sridevi-koduru/8b/76a/9b8/

    Like

Leave a reply to prakash Kumar Cancel reply