Skip to Content
author's profile photo
Former Member

How to check a single method is overriden in how many subclasses in ABAP.

Hi Experts,

I have a global superclass which had benn inherited by many other global subclasses. Is there any way to find out quickly (may be in a table ) in how many subclasses a particular method of the superclass is overriden?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Posted on May 04, 2011 at 07:18 AM

    Hi.,

    Go to se16 Enter SEOREDEF table name . Enter REFCLSNAME and MTDNAME (method name) ., it will give all classes where it is redifined.

    hope this helps u.,

    Thanks & Regards

    Kiran

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on May 04, 2011 at 07:06 AM

    Hi Manuish,

    You can use the class CL_OO_CLASS to achieve the above, below is a sample code.

    DATA: lcl_oo_class TYPE REF TO cl_oo_class,
          lw_seoredef  TYPE seoredef.
    
    TRY.
        CREATE OBJECT lcl_oo_class
          EXPORTING
            clsname = 'Y_TEST_CHEN_CLASS_SUB1'.
      CATCH cx_class_not_existent .
    ENDTRY.
    WRITE: 'Class', '                              ', 'Refclass', '                         ', 'Over written method', /.
    LOOP AT lcl_oo_class->redefinitions INTO lw_seoredef.
      WRITE: lw_seoredef-clsname,'         ',
             lw_seoredef-refclsname,'         ',
             lw_seoredef-mtdname,'         ', /.
    ENDLOOP.
    

    Alternatively you can look up the table "SEOREDEF" directly.

    Regards,

    Chen

    Edited by: Chen K V on May 4, 2011 12:37 PM

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on May 04, 2011 at 07:18 AM

    Other way then described above would be:

    - in table VSEOEXTEND give field REFCLSNAME = supeclass name, then get all classes which inherit from superclass (field CLSNAME )

    - for the above result query table TMDIR and get these classes' methods

    - now repeat step 2 for superclass

    The methods that are in both sets are the ones that are inherited and redefined.

    Regards

    Marcin

    Add comment
    10|10000 characters needed characters exceeded