Application Development 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: 

class.GetName or .InstanceOf(className) in ABAP

Former Member
0 Kudos

Dear all,

how do you realize the java methods/checks

class.GetName or

(Is)InstanceOf(className)

of a current class instance in ABAP OO ?

best regards,

Christoph Aschauer

2 REPLIES 2

ssimsekler
Active Contributor
0 Kudos

Hi Christoph

Will it be useful to use <b>RTTI (Run-Time Type Identification)</b>? That is, the class <b>"CL_ABAP_TYPEDESCR"</b> and its subclasses. One of its subclasses (<b>cl_abap_classdescr</b> as I remember) can be used to identify the type of an instantiated object.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

thomas_jung
Developer Advocate
Developer Advocate

Here is a little code sample where an ABAP Object gets its own class name:


  data: class_desc type ref to cl_abap_typedescr.
  class_desc = cl_abap_classdescr=>describe_by_object_ref( me ).
  data: class_name type string.
  class_name = class_desc->get_relative_name( ).