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

Finding out what Subtype a reference is

Former Member
0 Likes
314

Hi!

I'm trying to bulid an applicaton with abab g and as a Java developer I'm doing it with Abap Objects. Now I have a nice abstract superclass and now I have to check references what type they have, before casting them into the subclasses. I'm looking for something like "instanceof" in java. Does someone know how to do that in Abap?

Best regards

Patrick Lehmann

Hi!

I'm trying to bulid an applicaton with abab g and as a Java developer I'm doing it with Abap Objects. Now I have a nice abstract superclass and now I have to check references what type they have, before casting them into the subclasses. I'm looking for something like "instanceof" in java. Does someone know how to do that in Abap?

Best regards

Patrick Lehmann

1 REPLY 1
Read only

Former Member
0 Likes
289

Hi,

Sure, we do have runtime type identification for each object instance.

Use the Class CL_ABAP_CLASSDESCR to get the RTTI of any object instance.

Read more on how to use this class in Class documentation.

Hope this helps.

Regards,

Nagaraju Chidurupalli.