You Need to Automate Your SAP Code Reviews
You’re an SAP developer or a technical lead, and you’ve just finished writing a complex ABAP report. The code works, but you have that nagging feeling. Did you follow all the internal naming conventions? Are there any performance-sapping SELECT statements inside loops? Is the authorization check implemented correctly?
Manually checking every line of code against a 50-page development guideline is not just tedious; it’s error-prone and slows your entire team down. This is where the power of the SAP Code Inspector, and specifically the ATC check variant, becomes your greatest ally.
If you’ve searched for “how to create atc check variant in sap,” you’re looking to move from sporadic, manual checks to a consistent, automated quality gate. This guide will walk you through the entire process, from understanding the core concepts to building, activating, and using your own custom check variant to enforce your team’s standards automatically.
Understanding ATC, the Code Inspector, and Check Variants
Before we dive into creation, let’s clarify the terms. The ABAP Test Cockpit (ATC) is SAP’s integrated framework for static code checks, unit tests, and other validations. It’s the overarching system that manages how and when checks run.
The SAP Code Inspector (Transaction SCI) is the powerful engine underneath ATC. It contains the vast library of individual checks—over a thousand of them—that can scan your ABAP code for everything from syntax errors to security vulnerabilities and performance anti-patterns.
A check variant is your personalized configuration of this engine. It’s a named collection of specific checks from the Code Inspector’s library that you want to run together. Think of it as a playlist. The default “DEFAULT” variant includes many useful checks, but it’s generic. Creating your own variant allows you to tailor the inspection to your project’s specific rules, activating the checks that matter to you and deactivating the irrelevant noise.
Prerequisites for Creating Your Check Variant
You’ll need proper authorization. Typically, this means having the S_SCI_CTRL authorization object assigned to your user. If you can’t access Transaction SCI or see certain functions, contact your basis or security administrator.
Have a clear idea of your goals. Are you building a variant for general code quality? For a specific compliance standard like SAP Security Notes? Or for a custom in-house rule? Knowing this will guide which checks you select.
It’s also helpful to have a sample program or package ready. You’ll want to test your new variant immediately to see its output and fine-tune it.
Step-by-Step: Creating Your Custom ATC Check Variant
We will now go through the process in Transaction SCI. Follow these steps precisely.
Accessing the Code Inspector and Creating a New Variant
First, launch the SAP GUI and enter Transaction SCI in the command field. Press Enter. You’ll see the main SAP Code Inspector screen.
On the left-hand menu, navigate to “Management of” -> “Check Variants.” This will display a list of existing variants, including the SAP-delivered ones.
To create your own, click the “Create” button (or press F5). A dialog box will appear asking for a variant name. Choose a descriptive name that follows your team’s naming convention, like “Z_OURTEAM_QUALITY” or “Z_SECURITY_BASELINE.” The ‘Z’ or ‘Y’ prefix is customary for custom objects. Enter a short description that clearly states the variant’s purpose, such as “Custom quality checks for Project X.”
Click the checkmark or press Enter. Your new, empty variant is now created and selected in the list.
Selecting and Configuring Individual Checks
With your variant highlighted, click the “Change” button (or press F6). This opens the detailed configuration screen. Here, you’ll see a tree structure on the left categorizing all available checks (e.g., Performance, Security, Syntax, Programming Conventions).
This is where you build your playlist. Expand the categories that are relevant to your needs. For each check you want to include, find it in the tree and double-click on it. A small icon will appear next to it, indicating it is active for this variant.
Be selective. Activating hundreds of checks will make inspections slow and the results overwhelming. Focus on high-impact areas:
– Performance: Checks for SELECT in loops, missing indexes on database accesses.
– Security: Checks for critical authorization objects, dynamic SQL injection risks, hard-coded passwords.
– Syntax & Error Handling: Checks for missing exception handling in function modules.
– Programming Conventions: Checks for naming conventions (e.g., global variables must start with ‘G_’).
Many checks have further parameters. If you double-click on an active check’s name (not the checkbox), a configuration dialog may open. Here you can set thresholds, specify patterns, or define exclusions. For example, in a naming convention check, you can define the exact prefix pattern for local variables.
Saving and Activating Your Variant
Once you have selected all the desired checks, you must save your variant. Click the “Save” button (the disk icon) or press Ctrl+S.
Saving is not the final step. For the variant to be usable in ATC runs and, crucially, in the ATC Check System for automatic validations, it must be released. Look for the “Release” button (often a traffic light icon or a button with a similar label). Click it.
A released variant is locked for further changes by default, ensuring consistency. If you need to modify it later, you will have to first “unrelease” it, make your changes, save, and release it again.
Your custom ATC check variant is now ready for use.
Putting Your Variant to Work: How to Execute Checks
Creating the variant is only half the battle. You need to run it. There are several primary ways to execute an ATC check using your new variant.
Running a Check Manually in Code Inspector
Go back to the main SCI screen (Transaction SCI). In the “Check Object” section, enter the object you want to check: a single program name (e.g., ZMY_REPORT), a package, or a transport request.
In the “Check Variant” field, enter the name of your custom variant, ‘Z_OURTEAM_QUALITY’. You can also use the input help (F4) to select it from the list.
Click the “Execute” button (or press F8). The Code Inspector will run and present a detailed results list, categorizing findings as Errors, Warnings, or Information. You can drill into each finding to see the exact code line and a description of the issue.
Integrating with the ABAP Test Cockpit (ATC)
For team-wide enforcement, you integrate the variant into the ATC framework. Go to Transaction ATC (or SAUNIT_CLIENT_SETUP).
Navigate to the configuration for the “ATC Check System.” Here, you can assign your custom check variant to a specific check variant group or directly to a system context. This is an advanced configuration that often requires basis team involvement.
Once configured, ATC can run your variant automatically. For example, it can be triggered when a transport is released, when a task is completed, or on a scheduled nightly basis for critical development packages. Findings are then visible in the unified ATC results interface (Transaction ATC), where they can be assigned to developers for correction.
Troubleshooting Common Issues and Refining Your Variant
Your first run might not be perfect. Here are common issues and how to address them.
The Check Run is Too Slow or Has Too Many Findings
This usually means your variant is too broad. Go back into the variant configuration and review the active checks. Deactivate checks that are not critical for your current goals. For performance checks on large packages, consider scheduling them during off-hours instead of running them on every save.
Also, utilize the “Filter” and “Exemption” capabilities. You can create filters to exclude certain object types or apply exemptions to specific pieces of code that violate a rule for a valid, documented reason.
A Specific Check is Flagging Correct Code as an Error
Some checks are context-blind. For instance, a check might flag any use of a ‘COMMIT WORK’ statement as dangerous, but your batch program requires it. In this case, you have options.
First, check if the specific check has configurable parameters. You might be able to adjust its sensitivity. If not, and the check is not relevant for a certain class of programs, you might decide to deactivate it from your variant and rely on manual review for that specific rule.
As a last resort for exceptional cases, you can use a pseudo-comment in the code itself to suppress the check for that specific statement. For example, adding “#EC CI_COMMIT” on the line before a COMMIT WORK can tell the Code Inspector to ignore it. Use this sparingly and with team agreement, as it can hide real problems.
The Variant is Not Available in the ATC Check System List
Ensure you have released the variant. Unreleased variants are typically only visible to their creator in manual SCI runs. Also, verify your user has the necessary authorizations to see and use the variant in the ATC context. The variant may also need to be explicitly assigned to the relevant ATC configuration node.
Beyond the Basics: Advanced Strategies for Quality Governance
Once you’re comfortable with a single variant, you can build a suite of them for different purposes.
Consider creating a lightweight “Quick Check” variant with just 5-10 critical checks for developers to run before saving their code. Then, have a comprehensive “Gatekeeper” variant with 50+ checks that runs automatically during transport release.
You can also explore creating custom checks. If you have a unique company rule that isn’t covered by SAP’s standard library, you can develop a custom check using the Code Inspector’s extension interface (Check Class). This is more advanced ABAP development but allows for perfect alignment with your internal standards.
Finally, integrate the results into your DevOps pipeline. Using APIs and tools like the SAP Solution Manager or third-party integrations, you can pull ATC results into dashboards, making code quality metrics visible to the entire project leadership.
Your Path to Consistent SAP Code Quality Starts Now
Creating an ATC check variant is the definitive step from hoping your code is clean to knowing it is. It transforms subjective guidelines into objective, automated validations. Start small. Create a variant with a handful of high-impact performance and security checks. Run it on a recent development package, review the findings, and refine your selection.
Share this variant with your team. Incorporate its execution into your development workflow, perhaps as a mandatory step before creating a transport. The initial investment of an hour to set it up pays back exponentially in reduced debugging time, improved system performance, and stronger security posture.
Your code is a critical business asset. Manage its quality with the same rigor as your financial data. Build your check variant today and make automated code review a standard, non-negotiable part of your SAP development lifecycle.