Skip to Content
Technical Articles

How to Conduct Automatic Quality Check of ABAP Code in SAP S/4HANA and SAP ECC?

Introduction

SAP ABAP Quality Check for Coding. Every Company does It but still there are numerous Issues that Is not filtered and causes chaos In SAP Production System. There are some basic steps that a Technical Consultant needs to follow but since we are all Humans, we can make mistakes. On an average every Company spends at least 5-10 hours in resolving Quality Issues that should have been caught in the normal quality check process. SAP Is smart enough to do Its own quality check with the help of customized specification from different customers based on their requirements and guidelines.

Now with the current trend of reduce workforce the QA Code Team Is non-existant. ABAP Code Quality check still Is very Important to make sure erroneous code Is never moved to the Production Environment.

 

Objectives

  • Drawbacks of not doing Quality Check in Coding.
  • Time spent in fixing Quality Issues
  •  What Auto QA Check does for you?

 

Drawbacks of not doing Quality Check in Coding

  • Performance issue: Nowadays every Company has a lot of Data and the ABAP Code needs to be smart enough to run In an optimized way. A simple example can be a Technical Consultant writes a SELECT FOR ALL ENTRIES statement without Checking the INTERNAL TABLE  HAVE DATA POPULATED IN  IT.
  • Testing Issue: Ideally when you change the Code all the Test Scenario needs to be retested. 90% of the times when the erroneous code hits production system the company Is only wanting to fix the obvious bug without full cycle testing as It takes a lot of time.
  • De-scope or Re-scope of work: Since the QA check was not done properly all subsequent changes or upcoming changes needs to be reworked which may lead to De-scope or Re-scope of work
  • Get the blame from others fault. When something goes wrong Invariably the Blame Game starts. Everyone Involved related to that object should be blamed but most of the time the fault always goes back to the Technical Consultant.

 

Process of Fixing Quality Checks No Way

In Most companies with very few QA Expert the Quality check becomes a formality where everything Passes. Since It Is done by Human there are chances of making mistakes. Automatic QA check can get rid of this very Important Boring job to be done in an optimized fashion.

Process of Fixing Quality Checks Tough Way

Quality Check should not be time consuming so that It will affect the deliverables of the Object. Quality check should be fast and smart just like the Airport Scanning of Passenger

Process of Fixing Quality Checks Smart Way

Quality check should be done automatically before the code moves to the Quality System. The article below covers the way to do this.

 

 

Simple Flowchart of QA check of ABAP Code in SAP ECC 6.0 and S/4 HANA

Fig. 1:Flowchart of Current QA Process

Process after reading this Article the Smart Way. We do not believe In the Honor System, but we want the system to do the QA check rather than Human. We can spend this time In Innovating new solution SAP.

Fig.2: Flowchart Propose through Auto QA Check

 

Process of Fixing Quality Checks Optimal Way

  • Automate QA Review points while Developers are coding.
  • Reduce Ping Pong between QA Team, Testing Team and Developers.
  • Prevent a low-Quality Code moving to Production.
  • Automate Naming Convention and Development guidelines accordingly.

 

How to do the Auto QA Check?

Create an Implementation on BADI CTS_REQUEST_CHECK.

Go to SE18 Transaction Code

Enter Below BADI Name

Fig.3 BADI Implementation

 

Create Implementation

Fig 4 Create BADI Implementation

Fig 5 Create BADI Implementation continued

Fig 6 Implement Method

Here Is your Implementation. Now we Implement the method CHECK_BEFORE_RELEASE

 

Fig 7: Code which verifies Authorization Group Maintained In Program

The Company has a requirement where Custom Program should have an Authorization Group mentioned In the SAP Program attribute or else we get below Error Message.

Authorization Group is missing in &

 

 

 

 

 

 

 

 

 

Sample program with Authorization Group Missing

 

Fig 8. Program with Auth Group Missing

 

 

 

 

 

 

 

Now let us try to Transport this Code to Quality System. Below View shows for debugger

Fig 9 Debugger View showing error caught

Here Is the Error Message

Fig 10 Error message suggesting Authorization Group Missing

How the Automation helped?

  • Enforced our QA Review automatically.
  • Enforced Transport Dependency checks are done.
  • Enforced our Development Standards maintained
  • Enforced our Naming Convention was maintained.

Lessons Learned

  • Everything is possible if you think there should be a way out.
  • For sure make filters only to include custom objects which have Namespace(Z* or Y*)
  • Pilot this process with a Single User ideally the Developer who is building it.

Feeder Question

  • Can we use this concept/Enhancement in S/4 HANA?

Yes

  • Can we enforce naming convention through this?

Yes

  • Can we use this process to check existing code at one go?

Yes. We need to create a Custom Program to run the validation for each Program

  • Does this take care of ABAP Dictionary Objects also?

Yes. Sky Is the Limit 🙂

  • Can we read the mind of the Coder J?

Never but you can present some mistake they can do 🙂

7 Comments
You must be Logged on to comment or reply to a post.
  • Nicely presented.

    Personally, I think while all code should go through the automated QA process, there is still room for human checking. Not everything that's bad practice or bad coding will ever be picked up through automation.  I'm not suggesting all code should be human checked by another person (although I've worked at places where that was the case), but perhaps 10% of all code should have a human give it a once over.

    By the way the code you've screenshot would fail my QA checks on two criteria - insufficient modularisation and specifying a table with [ ]. Since you've opted for prefixs, to have it_...[] or lt...[] is redundant and goes against clean code practices.