Skip to Content

My CDS view self study tutorial – Part 12 CDS view source code count tool

For development complexity and draft effort estimation I need a tool to calculate the total line number of the CDS views belonging to a given package. Currently there is only the counting tool for ABAP source code: An ABAP tool to get ABAP source codes line number.
However no tool available for CDS view. So I write one. You can download its source code from my github.
Execute the public RUN method, specify the package number:
And it will print the line of source code for each view and the total count per package:
Two private methods of this tool class:
  • GET_PACKAGE_LIST: get all subpackage belonging to current input package
  • FILL_VIEW_NUMBER_PER_PACKAGE: get the view list of a given package, fetch the source code of each view from database table DDDDLSRC ( I have already explained this table in part 2 what objects are automatically generated after you activate one CDS view ) and perform the line number calculation.
If you have further requirement to parse the annotation contained in the view source code, you can refer to two demo reports shipped by SAP standard:
  • demo_cds_annotation_array
  • demo_cds_semantics_annotation
Be the first to leave a comment
You must be Logged on to comment or reply to a post.