Creating a global class from a local class

By Supriya

In this tutorial, we would look into the procedure of creating a global class using a local class defined in a program. 

Consider the following Z program, which contains a local class: 

REPORT  zclass_test.
*---------------------------------------------------------*
*       CLASS zcl_test DEFINITION
*---------------------------------------------------------*
*
*---------------------------------------------------------*
CLASS zcl_test DEFINITION.
  PUBLIC SECTION.
    METHODS: display.
ENDCLASS.                    "zcl_test DEFINITION
*--------------------------------------------------------*
*       CLASS zcl_test IMPLEMENTATION
*--------------------------------------------------------*
*
*--------------------------------------------------------*
CLASS zcl_test IMPLEMENTATION.
  METHOD display.
    WRITE: 'SAPTechnical.com'.
  ENDMETHOD.                    "display
ENDCLASS.                    "zcl_test IMPLEMENTATION 

Now let us create a global class SE24 using the above local class

Go to transaction SE24. 

 

Now select Object type à import à Local classes in program (As shown below): 

 

Following pop-up appears:

 

Enter your Z program in which the local class is defined and press ENTER.

 

The class name defined in our program is ZCL_TEST and the proposed global class name is CL_ZCL_TEST. Now you can rename the global class name as per your requirement. 

If the local class is defined inside an include, we need to check the checkbox “Explode INCLUDEs’.  

 

Now click on import. Following message would appear:

 

Now check the global class ZCL_TEST.  

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image