Life throws me interesting tasks. The other day I was thinking about ABAP code quality automation. There is a tool to control ABAP quality and it’s called ATC – ABAP Test Cockpit. Guess, we can setup system to verify ABAP code for quality in ABAP Code Inspector where we set rules for naming, code blocks, conventions, etc. We can ask the system to schedule code checks before any transport request moves forward to quality or production. The system will stop any transfer in case there are mistakes in code or even variables naming.

 

Testing ABAP Code in SAP

testing ABAP code in SAP (image owner/author is unknown)


For customers, I’d recommend to include such code/naming requirements in RFPs to start somehow building code development culture in your company. It will save a lot of cash in long-term period. Just don’t forget you need to pay for quality and following your procedures. Want to avoid backdoors or inefficient code – setup rules in Code Inspector which don’t allow to transport code until supervisor manually review and approve them. Disallow direct SQL to avoid permissions break with direct access to data. Develop security policies, performance policies, code management policies, templates, and snippets – it would save decent money for you in support and bug tracking.

 

Transaction SCI – Code Inspector – lets setup rules, list of objects/logins to control. Rules of the game are simple:

  1. Code must be ‘clean’ in performance, readability, security. Otherwise, refactor.
  2. Code must be 100% covered by Unit or Functional tests. Otherwise, you’ll get errors in production system.
  3. Bullets 1 and 2 must be documented, signed and obligatory. No exceptions.
  4. In case of issues start with bullet 3.

Ideally, Solution Architect defines the rules. Test Engineer writes functional test. Code developers ensure successful execution of tests. Quality Assurance Engineer ensures code acceptance. All these ABAP quality gates make a customer happy.

Setup ABAP Quality Toolset

Let’s open SCI transaction.

Here we see inspections, objects to control and rules (variants). It’s obvious, Cap. Inspection has on an object to verify and rules how to verify. Let’s check something from standard code, for example, standard staffing form T-3 with the rules vendor recommends himself.

Define an area for verification as only one our program.

SAP Code Inspector Object Set

SAP Code Inspector Object Set

Create a new inspection where we specify our list of objects and one of the standard check variants. In this case select variant check for variables naming convention. If you scroll standard variants you’ll see a lot of interesting things to use. They definitely worth walking through and copy as a template to your own.

SAP Code Inspector

SAP Code Inspector

Use ABAP Quality Toolset

I’ll run it and go for a tea meantime.

SAP Code Inspector Result Log

SAP Code Inspector Result Log

If you look closely, there is nothing critical. In your rules, you can delete checks for non-existing includes or delimit check area. Here SAP follows it’s own recommendations – no errors.

It remains to build a process. From my point of view, t could look this way. Daily scheduled  ABAP Unit Test of all code developments.  Release transport to integration testing system. At the moment of transport release, ABAP Test Cockpit runs Code Inspector. In integration testing system we schedule eCATT to fill the system with data and run functional and integration test automatically. If succeed manual tests are ran by test-person according to test plan.

As a result, we provide almost 99,9 ABAP quality-assured code and customizing fulfilling business requirements and therefore a quality of the solution which can be called industrial.

It could save up to 30% of your TCO costs.