Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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 a 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.