‎2009 Sep 30 10:32 AM
HI Guru,
I have a problem.
I need to count line of my program or function module or module pool without empty line for calculate a percentage of total line with a commnet line ('*')
you know a tool sap or external or you have a similar custom program?
thanks in advances.
Valerio
‎2009 Sep 30 10:48 AM
>
> I need to count line of my program or function module or module pool without empty line for calculate a percentage of total line with a commnet line ('*')
>
HI ,
Use the follwing Code ..
------------------------------------------------------------------------------------------------
TYPES: BEGIN OF T_TYPE,
LINE(72),
END OF T_TYPE.
data: ITAB TYPE STANDARD TABLE OF T_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 500 ,
WA TYPE T_TYPE,
count type i.
parameters: program type sy-repid default 'ZTEST''.
READ REPORT PROGRAM INTO ITAB.
IF SY-SUBRC = 0.
LOOP AT ITAB INTO WA.
if wa-line+0(1) = '*'.
count = count + 1.
endif.
ENDLOOP.
ENDIF.
Write:/ 'No of Comment Lines is ' , count .
--------------------------------------------------------------------------------------------------------------Regards,
Rajesh
‎2009 Sep 30 10:40 AM
Write the below statement in another report and run.
READ REPORT prog INTO itab [MAXIMUM WIDTH INTO wid]
[STATE state].
maximum width "wid" contains the lines in the report.
‎2009 Sep 30 10:48 AM
>
> I need to count line of my program or function module or module pool without empty line for calculate a percentage of total line with a commnet line ('*')
>
HI ,
Use the follwing Code ..
------------------------------------------------------------------------------------------------
TYPES: BEGIN OF T_TYPE,
LINE(72),
END OF T_TYPE.
data: ITAB TYPE STANDARD TABLE OF T_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 500 ,
WA TYPE T_TYPE,
count type i.
parameters: program type sy-repid default 'ZTEST''.
READ REPORT PROGRAM INTO ITAB.
IF SY-SUBRC = 0.
LOOP AT ITAB INTO WA.
if wa-line+0(1) = '*'.
count = count + 1.
endif.
ENDLOOP.
ENDIF.
Write:/ 'No of Comment Lines is ' , count .
--------------------------------------------------------------------------------------------------------------Regards,
Rajesh
‎2009 Sep 30 11:05 AM
thanks guru,
but this instruction work only for a report, but for a FM or module pool?
there is an another instruction?
V
‎2009 Sep 30 11:07 AM
‎2009 Sep 30 11:10 AM
‎2009 Sep 30 11:13 AM
Hello,
For Module Pool: Put SAPM* infront of module pool program.
For func. modules i am checking
BR,
Suhas
‎2009 Sep 30 11:23 AM
Hello,
I got the FM: RPY_FUNCTIONMODULE_READ, which will read the source code for the FM.
Pass the FM name to it & enjoy !!!
Added:
You can get the report name of the corresponding Func. Module from the table TFDIR. (TFDIR-PNAME)
BR,
Suhas
Tip: Check the "TABLES" SOURCE (structure RSSOURCE)