First analysis of ABAP code

After seeing in the previous post how to extract the ABAP code, with the help of the extractor provided by Sonar, it’s time to start our first analysis … but not with the code previously extracted.

In fact, the first time I set up an analysis for a new technology, I will make a first test with some files which I am sure have no problem, because this code has already been tested and proven by Sonar, and is downloadable from this page: Sonar Project Examples.

In this page you will find links to other pages in which navigate to search for different examples of projects. Or simply click on the link to download a compressed file.

In this file, you can see a folder ..\projects\languages\ with different sub-directories of source code, and the one we are looking for in a folder ‘abap’. Once unzipped, I’ll copy this directory in my analysis environment, renaming it ‘SonarAbap’.

Let’s have a look at it. We have:

  • A sub-directory ‘src’ with 2 files ‘ZBCMKZ17.abap’ and ‘ZZBGS106.abap’ (remember the naming conventions we have seen in this page).
  • A file ‘’ with different parameters for our analysis.

Configuring the analysis

We will perform our analysis with Jenkins, without presenting the details of its creation since you already know how to it for your Java applications. If you are a SAP consultant and / or have never used Sonar,, nor its installation process, our next series will be on a full installation of an analysis environmnent with Sonar.

We need to identify some generic parameters such as the project name or its version, and of course, the language and the location of the code to be analyzed:

In the example above, I took exactly the same parameters as in the ‘properties’ file provided by Sonar. I simply changed the root directory (‘project home’) for the folder where I did copy the code in my analysis environment under ‘C:\SRC\ABAP\SonarAbap’ (notice the ‘/’ used in this parameter to indicate this directory).

We can now run our analysis and verify the results.

Validation of the analysis

To validate our initial analysis, we will check the log under Jenkins. First, the following message …

tells us that the analysis has been processed correctly and that the results are available in the Sonar dashboard. Quickly browsing this log page, I do not see any message about any problem. We could have a ‘Warning’ message, which does not interrupt the analysis, in case any file would not be parsed correctly. So, it is a good thing to check the log at the end of the analysis.

We now can check in Sonar the results:

And look at the presence of defeccts for this code:

In the two files that have been processed:

We have seen how to set up our first analysis of ABAP code. We can easily replicate it into Jenkins to perform other diagnostics, and change the location of the code (project.home).

We could also check the results of this analysis, in the Jenkins log as in the Sonar dashboard.

We will see later what are the best practices for ABAP and which violations you should report, in order to present these results as an assessment of the quality of the code and an action plan.

Leave a Reply

Your email address will not be published. Required fields are marked *