Application Development 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: 

How to find number of code lines in a method

0 Kudos

I am making a tool to update our change log database with the objects that have been changed, based on the transports.

For BadI implementations I wish to also add the information about which method(s) are used, but this information does not exist in the transport, only the class and the implementation name.

Based on this I can of course find the names of the methods, but I cannot know which methods in the implementation have been used, since they are all active whether they have any content or not.

Therefore I am thinking that I need to find a way to read the number of code lines in a method, this way I will know which ones have been used.

I will appreciate any help on how to do this, or if you have any other suggestions on how to solve my problem.

Kind regards,

Claus Christensen

5 REPLIES 5

Varamanoj
Participant
0 Kudos

Hi,

did you check with read report statement it will read the program into one internal table.

Best Regards

Manoj

0 Kudos

Hi Manoj,

Thank you for your input, but my understanding is that READ REPORT can only be used on reports, and my question concerns only methods.

Kind regards,

Claus

0 Kudos

Hi Claus,

you can use READ REPORT statement for your requirement. I got a similar requirement couple of month ago - check the code below:

DATA gt_trdir TYPE TABLE OF trdir.
DATA gt_source TYPE string_table.
FIELD-SYMBOLS <gs_trdir>  TYPE trdir.
FIELD-SYMBOLS <gs_source> TYPE string.

SELECT * FROM trdir INTO TABLE gt_trdir
  WHERE name LIKE 'ZCL_YOUR_CLASS%'.

LOOP AT gt_trdir ASSIGNING <gs_trdir>.

  READ REPORT <gs_trdir>-name INTO gt_source.

  WRITE <gs_trdir>-name COLOR COL_GROUP.

  LOOP AT gt_source ASSIGNING <gs_source>.
    WRITE / <gs_source>.
  ENDLOOP.

  SKIP.
  ULINE.

ENDLOOP.

0 Kudos

You can make use of the CL_RECA_RS* classes to get the lines of the class method

@: I kept the promise of remembering these classes. Thanks

Edited by: Suhas Saha on Aug 11, 2011 5:50 PM

0 Kudos

Hi Suhas,

Thank you, I think this will enable me to solve my problem.

KR, Claus