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

Read ABAP codes from class method

former_member367551
Participant
1,828

Dear experts,

Is there a way for me to read ABAP codes from a class method?

I understand that the methods can be found from the database table SEOCOMPO where CMPTYPE = 1. But I'm still unable to find a way to read the ABAP source codes of these methods (tried searching for the necessary FMs to accomplish this, but I can't get any too).

Please help, if there are any ideas at all.

Thanks a lot.

1 ACCEPTED SOLUTION
Read only

Former Member
1,011

Hi Deborah,

You should have a look to MF SEO_METHOD_GET_SOURCE.

You have to fill MTDKEY with class name / method name and STATE with the state of activation of your method (in most of cases, you will have to put 'A' : activated)...

DATA : ls_mtdkey     TYPE seocpdkey,
         lt_source     TYPE TABLE OF edpline,
         lt_source_exp TYPE rswsourcet,
         ld_incname    TYPE program.

  ls_mtdkey-clsname = 'CL_ABAP_STRUCTDESCR'.
  ls_mtdkey-cpdname = 'CREATE'.

  CALL FUNCTION 'SEO_METHOD_GET_SOURCE'
    EXPORTING
      mtdkey          = ls_mtdkey
      state           = 'A'
    IMPORTING
      SOURCE          = lt_source
      source_expanded = lt_source_exp
      incname         = ld_incname
    EXCEPTIONS
      OTHERS          = 1.

Best regards,

Samuel

2 REPLIES 2
Read only

Former Member
1,012

Hi Deborah,

You should have a look to MF SEO_METHOD_GET_SOURCE.

You have to fill MTDKEY with class name / method name and STATE with the state of activation of your method (in most of cases, you will have to put 'A' : activated)...

DATA : ls_mtdkey     TYPE seocpdkey,
         lt_source     TYPE TABLE OF edpline,
         lt_source_exp TYPE rswsourcet,
         ld_incname    TYPE program.

  ls_mtdkey-clsname = 'CL_ABAP_STRUCTDESCR'.
  ls_mtdkey-cpdname = 'CREATE'.

  CALL FUNCTION 'SEO_METHOD_GET_SOURCE'
    EXPORTING
      mtdkey          = ls_mtdkey
      state           = 'A'
    IMPORTING
      SOURCE          = lt_source
      source_expanded = lt_source_exp
      incname         = ld_incname
    EXCEPTIONS
      OTHERS          = 1.

Best regards,

Samuel

Read only

0 Likes
1,011

Samuel, thanks a lot for the help. This works perfectly!