Skip to Content
0
Former Member
Jun 04, 2008 at 12:11 PM

Get Classname in static Methods

183 Views

Hi Object-Gurus,

i want to inherit a static factory method which contains the following code:

DATA: lr_obj type ref to object,

l_moff type i,

l_classname type string.

  • get current classname

FIND '=' IN sy-repid MATCH OFFSET l_moff.

l_classname = sy-repid(l_moff).

  • create object

CREATE OBJECT lr_obj TYPE (l_classname).

...

The problem is that when this method is started in a subclass,

sy-repid contains the name of the topclass. So the type of lr_obj is not the one i expected.

I don't want to use an attribute holding the classname, so is there a way to get the name of the subclass?

Thanks,

Patric