Skip to Content
11
Apr 15, 2015 at 01:38 PM

Determine class name used for calling a static method

3172 Views

Hi all,

I know static methods cannot be redefined, but they can be called using a subclass as the 'calling class name'. Is it possible to determine the object type used for calling a static method?

For example, I have ZCL_SUPER with a static method HELLO and a subclass ZCL_SUB.

I can use ZCL_SUPER=>HELLO( ) or I can use ZCL_SUB=>HELLO( ).

Both will execute the same code (correct), but is it possible to tell the difference inside the HELLO method? SY-REPID will always show the superclass (also correct).

I've found some similar threads but none with a clear answer.

Any input appreciated,

Mike