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

comparing two objects if they belong to same class

Former Member
0 Likes
531

Hi

do we have any way of determining this? like what we have in java

instance.getClass().getName();

Thanks...

AS...

Hi

do we have any way of determining this? like what we have in java

instance.getClass().getName();

Thanks...

AS...

1 REPLY 1
Read only

Former Member
0 Likes
398

Hi,

thanks...got the solution:

posting code here for someone else looking for the same thing:


data obj1 type ref to ZCL_OO_TEST.
data obj2 type ref to ZCL_WORKLOAD_TEXTS.
create object obj1.
create object obj2.

ref_descr ?=
    cl_abap_typedescr=>describe_by_object_ref( obj1 ).
    class_name = ref_descr->get_relative_name( ).

    ref_descr ?=
    cl_abap_typedescr=>describe_by_object_ref( obj2 ).
    class_name2 = ref_descr->get_relative_name( ).

    write: class_name,
           class_name2.


Thanks....

AS....