Skip to Content
Author's profile photo Jerry Wang

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

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Moni Jaiswal
      Moni Jaiswal

      Hello Jerry,

      The Github page for the tool you developed to calculate CDS view source code line is unavailable.

      Could you please provide the correct link, if the code is available yet.


      Author's profile photo Jerry Wang
      Jerry Wang
      Blog Post Author

      sorry, due to some reasons the original repo is deleted. You can access this url instead:

      Author's profile photo Moni Jaiswal
      Moni Jaiswal

      Thank you very much Jerry, very useful content!