*&---------------------------------------------------------------------*
*& Report ZCOUNT_ABAPCODE *
*&---------------------------------------------------------------------*
*& *
*&---------------------------------------------------------------------*
REPORT ZCOUNT_ABAPCODE .
tables: trdir.
types: begin of ty_proginfo,
program type programm,
counter type i,
empty type i,
comment type i,
source type i,
end of ty_proginfo.
data: st_proginfo type ty_proginfo,
it_proginfo type table of ty_proginfo,
st_progline type ty_proginfo.
field-symbols:
select-options: so_progr for trdir-name.
select name from trdir into table it_proginfo
where name in so_progr.
loop at it_proginfo assigning
perform count_program changing
add:
endloop.
write:/ 'Programs', 20 st_proginfo-counter,
/ 'Empty lines', 20 st_proginfo-empty,
/ 'Comment lines', 20 st_proginfo-comment,
/ 'Source lines', 20 st_proginfo-source.
*&---------------------------------------------------------------------*
*& Form count_program
*&---------------------------------------------------------------------*
FORM count_program USING p_proginfo TYPE ty_proginfo.
data: abaptab type standard table of string,
abaplin type string.
read report p_proginfo-program into abaptab.
check sy-subrc = 0.
add 1 to p_proginfo-counter.
loop at abaptab into abaplin.
if abaplin is initial.
add 1 to p_proginfo-empty.
elseif abaplin(1) = '*'.
add 1 to p_proginfo-comment.
else.
add 1 to p_proginfo-source.
endif.
endloop.
ENDFORM. " count_program
No comments:
Post a Comment