‎2009 Aug 27 6:29 AM
Hi Expets,
I would like to know is there any way to find the number of code lines in a ABAP program/function module.
Additionally, can i extend this to a package such that the utility will find the number of codelines in all the programs/function modules/include programs in that package.
Any hints regarding the same would be appreciated.
Regards,
Ramanath
‎2009 Aug 27 6:33 AM
‎2009 Aug 27 6:37 AM
Hi,
I understand the forum rules very well but because of some bug in the Forum framework, whenever the thread is edited, it will create another question instead of updating the same thread.
I hope the forum experts are already looking into this issue.
Regards,
Ramanath
‎2009 Aug 27 6:37 AM
Hi,
I understand the forum rules very well but because of some bug in the Forum framework, whenever the thread is edited, it will create another question instead of updating the same thread.
I hope the forum experts are already looking into this issue.
Regards,
Ramanath
‎2009 Aug 27 6:36 AM
Ramnath,
Check the syntax and F1 help of READ PROGRAM,may be you can get some lead.I remember a SAP standard program using such concept.
K.Kiran.
‎2009 Aug 27 6:38 AM
‎2009 Aug 27 6:49 AM
Hi
You can do it using the statement given below
P_report is a parameter which holds the program name.
data : it_report type standard table of string,"String
Read the report into internal table
read report p_report into it_report.
Describe the itab it_report to get the total lines
Regards
Ansari
‎2009 Aug 27 7:29 AM
1. First using Read report to load the source code to your internal table.
2. Using SCAN statement to do analysis about the source code. pls refer to the sap keyword help about "SCAN".
Syntax Diagram
SCAN
Note
This statement is for internal use only.
It cannot be used in application programs.
Variants:
1. SCAN ABAP-SOURCE itab1 ...TOKENS INTO itab2
...STATEMENTS INTO itab3.
2. SCAN AND CHECK ABAP-SOURCE itab1 ...RESULT INTO itab2.
Variant 1
SCAN ABAP-SOURCE itab1 ...TOKENS INTO itab2
...STATEMENTS INTO itab3.
Parts marked with " ..." are interchangeable
Extras:
1. ... FROM n1
2. ... TO n2
3. ... KEYWORDS FROM itab4
4. ... LEVELS INTO itab5
5. ... STRUCTURES INTO itab6
6. ... OVERFLOW INTO c1
7. ... WITH ANALYSIS
8. ... WITH COMMENTS
9. ... WITH INCLUDES [IMPLEMENTATIONS FROM itab]
10. ... WITH TYPE-POOLS
11. ... WITH LIST TOKENIZATION
12. ... PRESERVING IDENTIFIER ESCAPING
13. ... WITHOUT TRMAC
14. ... [INCLUDE] PROGRAM FROM c2
15. ... INCLUDE INTO c3
16. ... MESSAGE INTO c4
17. ... WORD INTO c5
18. ... LINE INTO n3
19. ... OFFSET INTO n4
20. ... WITH EXPLICIT ENHANCEMENTS [IMPLEMENTATIONS FROM itab]
21. ... FRAME PROGRAM FROM c2
22. ... ENHANCEMENTS INTO itab
‎2009 Aug 27 9:13 AM
Use READ REPORT.............statement to get the number of program line.
Example
read report ztest into itab.
describe table itab lines lin. it will give you the number of program lines
To get the program line of all the objects inside the package use the following example
Suppose you want to get the program line of all the programs inside a package 'ZPACK'
Thne fetch all the program names insde this package from table TADIR
select objname from tadir into itab_tadir
where
devclass = zpack and
object = prog and
pgmid = r3tr.
loop at itab_tadir into wa_itab_tadir.
read report wa_itab_tadir-obj_name into table itab1 (table length 2000 type c).
describe table itab1 lines lin.
write: lin
endif.
By this way you can get lines of all the program inside a package. for function module change object = FUNC PGMID = LIMU.
Hope this will help you.
‎2009 Aug 27 9:51 AM
Hi,
check this blog:
[How many lines of custom ABAP code are inside your system?|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12853] [original link is broken] [original link is broken] [original link is broken];
Kind Regards.
Andrea
‎2009 Aug 27 9:53 AM
Hi,
Try this
READ REPORT p_prog INTO it_report.
DESCRIBE TABLE it_report lines lv_lines.
Regards,
Prashant