2008 Apr 08 5:24 AM
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?
2008 Apr 08 6:52 AM
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
2008 Apr 08 7:07 AM
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.
2008 Apr 08 7:43 AM
2008 Apr 08 8:00 AM
2008 Apr 08 7:39 AM
2008 Apr 08 7:41 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |