Skip to Content
Author's profile photo Former Member

Cyclomatic complexity in ABAP

Introduction:-


The cyclomatic complexity measures the complexity of a program and is based on the control flow graph. It is a count for the number of linearly independent paths through the source code. It was developed by Thomas J. McCabe, Sr. in 1976.


The CC goes through a coding block and counts every time,  the control flow has a new path at a specific decision point. A new path will be created due to a “IF”, “ELSE”, “CASE” and so on.

Ideally, the CC should be between 7 and 15 at each coding block.


1. How to configure CCN

  1.1 Open any program using Tcode “SE38”. Go to program->check->Code Inspector

                   

               /wp-content/uploads/2015/12/cyclo1_857943.png

  1.2. Click on Utility->Default Check Variant->Maintain

                    Cyclo2.png

1.3 Select procedural metrics in selection screen. Click on green arrow button in front “procedural metrics”

                     /wp-content/uploads/2015/12/cyclo3_857951.png

  1.4 Select Show Metrics option. Change in “Scope and rule for metrics section as per your need”. Click on Ok     button.

                     /wp-content/uploads/2015/12/cyclo4_857952.png

 
  

2. How to check CCN

  2.1 Open  program using Tcode “SE38”. Go to program->check->Code Inspector

                /wp-content/uploads/2015/12/cyclo5_857953.png

  2.2  Go to “Procedural Metrics “ section. Double click on the detail line as per below screen shot

                     /wp-content/uploads/2015/12/cyclo6_857954.png

          

  2 .3  Cyclomatic complexity number should be displayed as output.

                    /wp-content/uploads/2015/12/cyclo8_857955.png

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo B. ATM
      B. ATM

      Is this common for SAP ABAP or other program language?