Code Quality Control, Simplified!!

0
119
SAPYard

After Simple Logistics and Simple Finance, should we coin this as Simple Code Inspector? 🙂

We assume that by now all the SAP Technical Consultants are aware of “ABAP Test Cockpit” also abbreviated as ATC. If not, please check the below two articles:
ABAP Test Cockpit(ATC) – Introduction and Steps
ABAP on SAP HANA: Part XVII. ATC – ABAP Test Cockpit Setup & Exemption Process

Anyway, as a refresher, I would like to point out some key aspects of ATC.

  • It is a code quality assurance tool from SAP.
  • It is directly integrated with ABAP workbench and available in Eclipse too.
  • It is compatible with Code Inspector, which means that the variants created in SCI can be used in ATC.
  • It has more amazing features than SCI viz. filtering, navigation and re-check functionality.
  • It has an exemption approval process wrapped around the entire ATC framework, which allows controlling the code quality with 4-eye principle.
  • It is tightly integrated with the transport management. With this, you could configure the ATC framework to allow/disallow transport request release based on the ATC issues left behind in the technical objects of that transport. This way, you can control poor quality code getting crept into higher systems in the stack.
  • Last, but not the least, it is highly recommended code quality control tool for all the HANA projects. It can also be used for determining HANA impact assessment for any client who wishes to move to HANA.

Anyway, the blog is more to highlight the new functionality of “Baseline” that SAP has introduced as part of SAP NetWeaver AS for ABAP 7.51 innovation package.

Why did SAP come up with functionality?

Using ATC is a value-add for all new technical objects but if the same is applied to a code base which is being developed & maintained from past 1-2 decades, then you would come up with hundreds and thousands of ATC issues.

Resolving those is extremely time consuming and would require extensive functional testing. It is also quite possible that instead of resolving ATC issues, we might end up introducing a bug in the code which can go untested to production. This is a major risk and hence a blocking point for most of the customers from using it.

Also Read: Exceptional SAPUI5 Code Sample Explanation for ABAPers

What is Baselining?

With this functionality, you can exclude all the ATC issues of the old code so that they stop coming up again in the next ATC run as they would be treated as special kind of exempted issues.

This way, if you make a small change in the old code, and run the ATC again, the ATC result will contain only those issues pertaining to the change that you made. Fantastic, isn’t it?

How to Baseline the old code?

  • Using ATC transaction, you can schedule an initial RUN (Transaction ATC à Runs à Schedule Runs) with a specific object set, or a package or any chunk of technical objects for whom you want to baseline the old ATC issues.
  • The scheduled run can be monitored using “Monitor and Control Runs” within the ATC transaction.
  • Once the run is finished, you can see the results using “Manage Results” node. In SAP ABAP 7.51, you would be able to see a new button called “Baseline”. Choose the scheduled run record and click on “Baseline” button. It will further give the options of whether these results should be categorized as:
    • Suppressed findings
    • Low priority findings
    • Exempt findings.

With it, you have basically asked the ATC framework to stop showing them in the ATC results, if at all you re-run the ATC tool for those technical objects.

Now, since the old legacy issues are treated as special exemptions, you can have much better control over the old deployment in the higher stack systems.

Do we have any problem with Baselining?

Well, we do!

As I mentioned that old legacy code is treated as special exemptions, but only until the mapping between the issue and the code line is maintained. If at all you introduce additional code lines in between, then the code lines are shifted downwards and hence the mapping is disturbed. For all the disturbed mapping (code lines), the baselining is destroyed and the issues start coming up again in your ATC run results.

Nevertheless, we still have an extensively reduced set of ATC issues compared to what we had previously without baselining.

Also Read: How to Create your first OData Service in SAP

What if I am not yet on SAP ABAP 7.51?

Well, the concern for all the customers below SAP NetWeaver AS for ABAP 7.51 is still not resolved.

They still must deal with the long list of ATC issues that crop up in every ATC run. Based on the experience that I have with ATC tool, here is my suggestion for all those customers:

Create 2 SCI variants to be used in ATC tool.

One variant should be configured in such a way that contains only static code checks which are easier to fix and certainly should bring in more robustness. For example:

  • Check of SY-SUBRC Handling
  • Unsecure use of FOR ALL ENTRIES
  • Search for APPEND and INSERT … INDEX in SORTED Tables
  • Search problematic statements for result of SELECT/OPEN CURSOR without ORDER BY

This variant should be used for all the fixes/CR’s which are done in the old code.

The second variant should be configured more aggressively including all performance checks, naming conventions check and robust programming checks. This should be mandatorily used for all new developments and should be adhered religiously.

Lastly, based on my experience with ATC, I would like to mention that quality code delivery is a discipline which needs to be inculcated irrespective of how big or how small the change we are doing and ATC tool is the way to bring such a discipline in us. While using it extensively, you will get adapted to looking at quality code so much that any poor quality will catch your eye instantly 😊

Enjoy coding.

Please consider this and take the actions you deem appropriate to maintain the sanity of your technical developments.

Do you have any tips, tricks, tutorial, concept, config, business case or anything related to SAP to share? Write articles at SAPYard and EARN up to 500 INR per article? Please contact us at mail@sapyard.com to know more.

If you GENUINELY like our articles then it would be a HUGE help if you shared, subscribed and liked us on FacebookIt might seem insignificant, but it helps more than you might think.

We have organized all our SAP Tutorials on one page. Please visit the below link to find all materials at one convenient place.

All SAP Tutorials at One Page

LEAVE A REPLY

Please enter your comment!
Please enter your name here