Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get Classname in static Methods

Former Member
0 Likes
588

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

1 REPLY 1
Read only

Former Member
0 Likes
405

Hi,

static methods cannot be redefined.