Skip to Content
0
Sep 27, 2010 at 10:10 AM

How to declare a class object which will be created dynamically.

22 Views

Hi,

The following code snippet does not work. How can i declare the variable lo_content so that

i can achieve the object creation based on class availability.

********************************************************************************

DATA:

lo_content TYPE REF TO data .

if class 'cl_ap_a2x_service_manager' exists.(using a FM SEO_CLASS_GET)

CREATE OBJECT lo_content TYPE ('cl_ap_a2x_service_manager').

endif.

********************************************************************************

I cannot declare it as: lo_content TYPE REF TO cl_ap_a2x_service_manager .

I will not allow to activate the code as class cl_ap_a2x_service_manager doesnot exist in the same system.

Regards,

Bikash.