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

LOC

Former Member
0 Likes
980

Is there any table to show the exact no. of lines of code in a program or a function module?

Is there any table to show the exact no. of lines of code in a program or a function module?

6 REPLIES 6
Read only

Former Member
0 Likes
887

Hi,

I don't think that there exist a function module that gives you the exact number of line of ABAP report of Function Module.

But you can do the following to have the info

Line for a ABAP program

DATA: BEGIN OF itab OCCURS 0,

line(255) TYPE c,

END OF itab.

DATA : BEGIN OF ipgm OCCURS 0,

pgm TYPE tadir-obj_name,

END OF ipgm.

data : i_tfdir type standard table of tfdir with header line initial size 0.

SELECT obj_name FROM tadir INTO TABLE ipgm

WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name ='ABAP_name'.

READ REPORT ipgm-pgm INTO itab.

DESCRIBE TABLE itab LINES l_lines.

Line for a Function module

SELECT * FROM tfdir INTO TABLE i_tfdir WHERE funcname = 'function_name'.

LOOP AT i_tfdir.

CLEAR l_lines.

CONCATENATE i_tfdir-pname 'U' i_tfdir-include into ipgm-pgm.

ipgm-pgm = ipgm-pgm+3.

READ REPORT ipgm-pgm INTO itab.

DESCRIBE TABLE itab LINES l_lines.

ENDLOOP.

Hope this will help

Regards

Edited by: Jürgen Degraeve on Apr 8, 2008 7:52 AM

Edited by: Jürgen Degraeve on Apr 8, 2008 7:53 AM

Edited by: Jürgen Degraeve on Apr 8, 2008 7:55 AM

Read only

Former Member
0 Likes
887

Hi,

This Function module 'RPY_PROGRAM_READ' output will be an internal table with the

specified program name's code.

For eg,

if i EXPORT 'ZTEST' as the program name,

The function module gives me the codes of the 'ZTEST' in the internal table IT_CODE[] in TABLES of the function module.

CALL FUNCTION 'RPY_PROGRAM_READ'

EXPORTING

language = sy-langu

program_name = 'ZTEST'

  • WITH_INCLUDELIST = 'X'

  • ONLY_SOURCE = ' '

  • ONLY_TEXTS = ' '

  • READ_LATEST_VERSION = ' '

  • WITH_LOWERCASE = ' '

  • IMPORTING

  • PROG_INF =

TABLES

  • INCLUDE_TAB =

  • SOURCE =

source_extended = it_code[]

  • TEXTELEMENTS =

EXCEPTIONS

cancelled = 1

not_found = 2

permission_error = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

or use,

READ REPORT prog INTO itab [MAXIMUM WIDTH INTO wid]

[STATE state].

to get the code of a program into your internal table.

Hope this helps.

Read only

0 Likes
887

hi jagannathan krishnan,

Thank you.

cheers,

sharin.

Read only

0 Likes
887

No problem, If i knew any answer i would definitely help.

Read only

Former Member
0 Likes
887

Hi Jürgen Degraeve,

Thank you.

Cheers,

sharin.

Read only

0 Likes
887

No problem, glad I could help you out

Regards