5 Replies Latest reply: Apr 25, 2012 10:37 AM by Amit Mittal RSS

How to ensure code quality?

Jean Baro
Currently Being Moderated

Hi there.


I am fairly new to SAP/ABAP and would like to ensure the quality of code with goes into our SAP ERP. If we could trust all the developers who work with us, then this task would be much easily achieved. Even if that were the case I still think those techniques are quite helpful (not to say, essential).


In Java, or any other mainstream platform, they use TDD, BDD, Continuous Integration (like Jenkins) and other plugins, like:


  •     PMD and FindBugs (Search for bad and highly complex written pieces of code);
  •     Selenium (mostly for Web applications);
  •     Sonar (Check the test coverage and show many other "metrics" about the code, really cool stuff);
  •     Fuzzing Test (Check if there is any basic security flaw);
  •     JMeter (Check the performance of the application and its integrations and how any new commit affects it);


We could add many other plugins if we want to, but those are the basic ones which most serious projects use when the platform is Java. I know most of you guys are familiar with those concepts and techniques, which have been in use since last millenium .


Now, what are the tools, concepts or techniques which can be used in SAP/ABAP to achieve similar level of code quality and also quick feedback? I have found there is ABAPUnit (for the TDD part), but I wasn't able to find anyone who used it in real projects. What about BDD, CI...?


Even better, what are the companies using those?


Any help would be much appreciated.



  • Re: How to ensure code quality?
    Krishnendu Laha
    Currently Being Moderated



    In my experience most of good developers mainly concentrate on -

    1. Maintainability

    2. Readability

    3. As much as possible less database hit and processing in application server


    There are few SAP provided tools like code inspector, extended syntax check, memory usage global variables are together can guide to good performed code.


    Beside that there are some settings in SAP ABAP editor like - give error if read without binary search for sorted table helps to improve performance.




  • Re: How to ensure code quality?
    Naimesh Patel
    Currently Being Moderated

    In SAP you have tools like Code Inspector (SCI), Extended Program check (SLIN), Program analysis (SAT & ST12). You can use these tools to make sure, they pass from the standard checks.


    There is not much written content about the ABAP Units. I know there are people who have used it who are working on Agile and TDD. I have used it couple of clients place. Due to the face - lack of mock objects make is difficult to write Unit Tests for few of the methods. The code needs to separate out the logic vs access to DB, calls to BAPIs, etc.


    Naimesh Patel

  • Re: How to ensure code quality?
    swagi chirakkal
    Currently Being Moderated

    Hi Jean,


    The basic tool used for ensuring code quality is the Extended program check (SLIN).


    To access it:


    Go to the program editor -> Program (in the above menu bar) -> Check -> Extended program check.

  • Re: How to ensure code quality?
    Klaus Ziegler
    Currently Being Moderated

    Hello Jean,


    SAP offers various tools and techniques to ensure high quality software. These tools underly an evolution and depending on the release of your system may offer more or less features.


    Your system should contain some documentation on quality related tools and their capabilities. So for the tool part you may get some info from the system itself, as starting point you may try transaction /NABAPHELP and search for the term ABAP Unit. The hits should somehow refer to a page like this:




    Best Regards


  • Re: How to ensure code quality?
    Amit Mittal
    Currently Being Moderated

    Hi Jean,



    There are 2 things to ensure this:


    1. Standard Tools inside SAP

    2. Code review checklist (which we can prepare)



    For 1.

    Tthe tools are extended program check (SLIN) and code inspector.

    They will basically highlight general abnormalities. If those abnormalities are corrected, the code will be generally ok. However as below,


    For 2.

    However, there are some points eg. Clearing a itab/variable/structure before populating, authorization check in our program. change history logging inside the code, hardcoding and constants, checking if ITAB is not empty just before using FOR all entires, etc which standard tools will not detect normally. Hence for such things, we can design a CHECKLIST kind of document (based on our experience and general guidelines). The code should be reviewed against this checklist to ensure better quality.



    Hope this helps.



    Amit Mittal.