ABAP Test Cockpit (ATC)

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Before ABAP code goes to other systems, someone should check it for mistakes that a compiler does not catch: code that is slow, code that is unsafe, code that breaks the team’s conventions, or code that calls objects SAP has not released for your use. The ABAP Test Cockpit, ATC for short, is the SAP tool that does this checking. You point it at a class, a package or a whole software component, it runs a chosen set of checks, and it lists the findings with a priority each. A newcomer meets ATC in two moments: when the Eclipse editor shows findings while developing, and when a transport request refuses to be released because a finding of high priority is still open. This page explains what ATC checks, what a check variant is, how to start a run, how the transport gate and exemptions work, how pragmas silence a warning, and how ATC differs from the formatter ABAP Cleaner. The product pages cited are written for the SAP BTP ABAP environment, ABAP Cloud development (ABAP for Cloud Development release 9.20, 2608) and the classic on-premise tools of Standard ABAP release 8.16; where the two differ the text says so. ATC itself needs an SAP system and is not run here. Section "A runnable analogue" runs abaplint, an unrelated open-source checker, in the local lab to show what a static check run looks like.

Before you read

Key terms

  • ABAP Test Cockpit (ATC): SAP’s tool for static code analysis of ABAP development objects, which also runs ABAP Unit tests.

  • Static code analysis: checking source code without running it.

  • Check variant: a named set of checks that an ATC run executes.

  • Code Inspector: the older SAP check tool, started with transaction SCI, whose name still appears inside ATC settings.

  • ATC exemption: an approved request that hides one finding that cannot be fixed now.

  • Pragma: a marker written in the source that silences one warning of the compiler or of the extended program check.

  • Cloudification Repository: the list of released and not released SAP objects, with successors, that an ATC check reads.

What ATC is for

ATC is the tool of choice for static code analysis in ABAP, which means checking the source without running it. SAP’s overview for the ABAP environment says that it checks development objects for many types of problems: syntax errors, potential performance problems, suboptimal or potentially faulty programming, adherence to standards, and errors in ABAP Unit tests. The same overview names the two quality tools that matter most for custom code: ABAP Unit for dynamic tests and ATC for static analysis. ABAP Unit is the framework that runs test methods you wrote; ATC can run those tests as part of a run and reports a failing one as a finding.

ATC answers three questions. Does my object break a rule that the team agreed on? Is it ready for the cloud, that is, does it call only released objects? And is it safe to move to the next system? The first is answered by the standard checks, the second by the cloud readiness checks, the third by the transport gate described below.

Check variants

An ATC run does not execute every check that exists. The basic configuration is the check variant, a named list of the checks to run. In the ABAP environment the default variant is ABAP_CLOUD_DEVELOPMENT_DEFAULT. SAP describes it as containing all recommended checks to fulfil the ABAP cloud code quality standard, including the execution of ABAP Unit tests. You can copy a variant and add more checks to the copy, and you can add checks you wrote yourself.

A second variant matters when old code has to move towards ABAP Cloud. The SAP-samples cheat sheet on ABAP for Cloud Development says that the variant ABAP_CLOUD_READINESS verifies whether code written in classic Standard ABAP is cloud-ready. In its example a class that calls an unreleased class is checked with this variant, and the findings, the errors and warnings that show the code is not cloud-ready, appear in the ATC Problems view of ADT.

The cloud readiness checks need to know which objects are released. That knowledge lives in the Cloudification Repository, a list that SAP publishes as a JSON file in a GitHub repository. Its README says the file is the content of the ATC check "Usage of Released APIs (Cloudification Repository)", that the list also contains the objects that are not released together with their successors, and that customers and partners use the check to analyse custom code against released and not released APIs. For the check to use the file, you activate the check in your variant and enter the file’s URL in the check’s attributes; the README names the exact files for each target product. The Cloudification Repository viewer is a web page for browsing the same content.

For clean core governance in the ABAP environment SAP recommends these checks in a variant: Allowed SAP enhancement technologies, Usage of APIs, Critical statements, and the optional Code Vulnerability Analyzer, which needs its own licence. SAP adds that the default variant can be copied and extended with them. Clean core is SAP’s term for keeping custom code on released interfaces so that upgrades stay safe.

Running a check from ADT

In ADT you start ATC from the context menu of an object or a package. The cheat sheet’s example opens the context menu of a class, chooses Run As, then "ABAP Test Cockpit With…​" and types the name of the variant in the dialog. The run can take a while. The results then show up in the ATC Problems view; a double-click on a finding opens the detail. In Visual Studio Code the equivalent commands are called "ABAP: Run ABAP Test Cockpit" and "ABAP: Run ABAP Test Cockpit With…​", the second one taking a different global check variant than the predefined one.

On the ABAP environment you can also start a run through a REST interface and receive the results in checkstyle format, which lets a build server consume them. The page describes a communication arrangement for the scenario SAP_COM_0901, a CSRF token, a POST that starts the run with an optional configuration and check variant, a status poll, and a final request that returns the results. A check variant passed in the request replaces the default variant of the configuration. ATC can also run on a schedule against a test system through the ABAP environment pipeline.

The classic transactions are still there. Transaction SCI maintains Code Inspector check variants and transaction ATC holds the administration, for example the basic settings that name the global check variant. The SAP page on the ATC developer scenario shows how an on-premise system uses a central check system in the cloud: you enter an RFC destination as reference check system in a section of the ATC basic settings that is still called Code Inspector, and you create a proxy variant in SCI that points to a variant in the cloud system.

Priorities and the transport gate

Every finding has a priority. SAP’s overview describes the default quality gate of the ABAP environment: the release of transport tasks and transport requests is the basic gate. For findings of priority 1 and 2 the system blocks the release in the default setting. For priority 3 the developer only gets a notification. You can sharpen this default.

Priority Default behaviour at transport release in the ABAP environment

1 and 2

The release of the task or request is blocked.

3

The developer gets a notification.

SAP also recommends measuring ABAP Unit test coverage of all objects in a transport before releasing it, and gives above 80 percent as an example of high coverage.

The settings that decide which priorities block live in the app Configure ABAP Test Cockpit, which maintains ATC configurations in the SAP Fiori launchpad. With it you assign a check variant, change priorities, set the priority levels that block or interrupt transport releases, set a default configuration and set the handling of pseudo comments and pragmas. The app supports several configurations, while edits made in the transactions ATC and SCI only affect the active one. With a central check system in SAP BTP, SAP describes a blocking mode in the development systems that enforces compliance for priority 1 and 2 findings, so critical issues are fixed before transports reach higher systems.

flowchart LR A[Developer changes a claim class] --> B[Run ATC from ADT with a check variant] B --> C{Findings?} C -- No --> D[Release the transport request] C -- Yes --> E{Can it be fixed now?} E -- Yes --> F[Fix the code and run again] F --> B E -- No --> G[Request an exemption] G --> H[Approver decides] H -- Approved --> D H -- Rejected --> F D --> I{Priority 1 or 2 still open?} I -- Yes --> J[Release blocked] I -- No --> K[Transport reaches the next system]

Exemptions

Some findings cannot be corrected: a fix may be planned for a later cycle, only a test program may be affected, or the check may report a false positive. In that case you request an exemption. Once approved it masks the error or warning, so the finding no longer shows as an open issue in the ATC results. In the ABAP environment exemptions are transportable objects of the type CHKE, and the request and approval workflow is integrated in ADT.

For a central check system, SAP offers the Fiori app Approve ATC Exemptions. It lets an approver list exemptions of all states, read the justification, see how wide the exemption is (the object scope: finding, object, sub-object or all objects of a package; and the check scope: finding, check message or check), see the system group it would apply to and its expiry date, approve or reject, and give an assessment. The same page says that exemptions of type CHKE are not supported by the app and are approved in ADT. SAP also tells you to remove temporary exemptions once the real fix exists. For an on-premise ATC system, transaction SATC_EXPORT_XMPT downloads its exemptions so that the app can replicate them to SAP BTP; releases between 7.52 and 7.58 of SAP_BASIS first need SAP Note 3480722 for this function.

Pragmas

An exemption is a process with an approver. A pragma is the small, local alternative for warnings of the compiler and of the extended program check. It is written in the source as two number signs and a code. The Keyword Documentation says a pragma applies to the statement that ends at the next period or comma, that the pragma code decides the effect and optional parameters restrict it, and that pragmas replaced the older pseudo comments of the extended program check, which are obsolete. The program ABAP_SLIN_PRAGMAS shows which pragma replaces which pseudo comment. Pragmas for the extended program check are named in the long text of the matching message.

The example below is taken from the Keyword Documentation. The Keyword Documentation says the first pragma hides a warning of the extended program check about the variable, and the second one a warning about the text literal. It requires an SAP system; not run here.

DATA text TYPE string ##needed.

text = 'Hello Pragmas' ##no_text.

Use a pragma only when you know the warning is wrong for that line, and never to hide a real finding.

Code Inspector, ATC and the other checkers

The name Code Inspector survives in transaction SCI and in a section of the ATC basic settings, as shown above. The Clean ABAP style guide lists ATC, Code Inspector, Extended Check and Checkman side by side as SAP tools that provide some checks for finding issues. Some tools plug into them. The open-source tool code pal for ABAP is a set of checks for the Clean ABAP style guide, free to use, and the README says it is supported by Code Inspector (SCI and SCII) and by ATC in both SE80 and Eclipse, and that it supports exemptions. Its README calls this version the legacy one for local checks from SAP_BASIS 7.40, and links a separate Cloud Edition for ABAP Cloud.

ABAP Cleaner

ATC reports problems and leaves the fix to you. ABAP Cleaner is a different kind of tool: an open-source, configurable program that rewrites code. Its README says it applies more than 100 cleanup rules to a section of code, from a single statement to a whole document, and that the rules cover formatting, alignment, replacing obsolete commands and reducing some nesting. It ships with two profiles. The default profile enables most rules; the essential profile enables only those the Clean ABAP style guide explicitly demands. You can make your own profiles and share a team profile.

From ADT for Eclipse or for VS Code you run it on the current selection with one key press, or open an interactive view that shows the changes and lets you revert single ones before applying them; a third mode shows a read-only preview when you have no development authorisation in the system. With SAP GUI you use the stand-alone app and copy the code through the clipboard. The README says plainly that automation covers only a subset of the clean code rules; good naming, modularization and testability stay your job. A team can run ABAP Cleaner at the keyboard and ATC at transport release; the first changes the code, the second only judges it.

Source: ABAP Cleaner

A runnable analogue

ATC runs inside an SAP system, so the listings above were not run. To see what a static check run does without one, the local ABAP lab includes abaplint, an open-source reimplementation of the ABAP parser that the Clean ABAP style guide describes as working without an SAP system on code serialised with abapGit. abaplint is not ATC and not an SAP product: it has its own rules, its own configuration file and its own messages, and a clean abaplint run says nothing about ATC. It is used here only because it behaves the same way: it reads the source, applies the rules of a configuration and prints one line per finding.

The lab’s configuration abaplint.json switches on the rules unused_variables and keyword_case among others. The report below deliberately breaks both rules. The lab’s running table is a reduced version of ZEXP_CLAIM, and this report does not need it.

REPORT zlint_demo.

DATA total TYPE i.
DATA unused_count TYPE i.

total = 5.
write / total.

Running npm run lint in the lab prints the lines below after a few lines of version information, which are left out.

src/zlint_demo.prog.abap[4, 6] - Variable "unused_count" not used (unused_variables) [E]
src/zlint_demo.prog.abap[7, 1] - Keyword should be upper case: "write" (keyword_case) [E]
abaplint: 2 issue(s) found, 8 file(s) analyzed

Each line gives the file, the line and column, the message, the rule name and a severity letter. After deleting the unused variable and writing WRITE in capitals the run ends with abaplint: 0 issue(s) found, 8 file(s) analyzed. The cycle is the same as in ADT: run, read the findings, fix or justify, run again.

Summary

  • ATC is SAP’s static code analysis tool for ABAP; it checks without running the code and can also run ABAP Unit tests.

  • A check variant names the checks of a run. ABAP_CLOUD_DEVELOPMENT_DEFAULT is the default in the ABAP environment, and ABAP_CLOUD_READINESS checks whether classic code is ready for ABAP Cloud, using the Cloudification Repository.

  • In ADT you start a run with Run As, ABAP Test Cockpit; results appear in the ATC Problems view.

  • By default the release of a transport is blocked by findings of priority 1 and 2, while priority 3 only notifies.

  • An exemption, approved by someone else, hides a finding that cannot be fixed now; a pragma silences one warning of the compiler or extended check on one statement.

  • Code Inspector is the older name that remains in transaction SCI and in ATC settings. ABAP Cleaner rewrites code, ATC only reports, and abaplint is a separate open-source checker that is no substitute for ATC.

Try it

To do this by hand, follow the guide Check Code against Clean ABAP Rules: it checks a class against Clean ABAP rules with abaplint and fixes the findings.