Technical Articles
How to create your own ATC check in ABAP Development Tools for Eclipse
UPDATE: This functionality is supported and recommended in SAP BTP, ABAP environment and SAP S/4HANA Cloud, public edition and SAP S/4HANA >= 2022 Cloud, private edition and on-premise |
Now it is possible to create your own custom check in ABAP development tools for Eclipse by using the released API IF_CI_ATC_CHECK.
The API looks as following:
and you can also take a look at the provided example implementation of an ATC check:
Let’s take a look how you can create your own ATC check. In the following example the class ZCL_ATC_CHECK_CLASS_NAME (based on the API IF_CI_ATC_CHECK) was implemented with the purpose to check naming convention of the class names. Now it is possible to implement an ATC check based on that class.
First the new ATC check category will be created to bundle custom ATC checks (e.g. using the context menu New -> ABAP Repository Object (Ctrl+Shift+N)):
The Description field shows how the new check category will appear in the ATC check variant:
The Parent Category will be just left empty:
After that, new ATC checks can be added to this category. Let’s create a new ATC check which checks the names of classes against a naming convention. You can do it, again, e.g., using the New -> ABAP Repository Object context menu, but it can be done faster, now. After creation of the ATC check category, you will get the new ABAP Test Cockpit node in your Project Explorer which bundles all ABAP Test Cockpit related objects: Check Categories, Checks and Check Variants. You can use the context menu New -> ATC Check on the ABAP Test Cockpit node to create your ATC check:
Just enter the Name and Description of the check and the Category and Implementing Class and choose Next:
This is how the new ATC check editor looks like:
You can change some data here, e.g., enter the Description. After that, save and activate the new ATC check.
Now it’s time to create a new ATC check variant containing this new ATC check (using the ABAP Test Cockpit node context menu New->ATC Check Variant):
This is how the new ATC check variant editor in ABAP development tools for Eclipse looks like:
The new ATC check appears under the new ATC check category (which contains other custom ATC checks, which were added there meanwhile). Here, you can include the new ATC check into your new ATC check variant and define the parameters of the check. In this example, the ATC check variant ZMY_NAMING_CONVENTION will consist only of the new ATC check which will check the names of classes for beginning with ZCL_CI. If it is not the case, the check will report an ATC error. After saving and activating the new ATC check variant it’s time to check your custom code package with it:
The results in the ATC Problems View show the ATC naming convention errors for the names of the classes, which don’t begin with ZCL_CI:
Hi Olga,
While attempting this on an on-premise S4/HANA (2022) we are confronted with the fact that we cannot create ATC Check Variants (Categories, and Checks did succeed..) via Eclipse and ADT with error message: "The client does not support the required content type for object type Check Variant".
We tried, as a workaround, to create the variant via SAP GUI and ATC in the classical manner.
However we cannot add our custom checks to the variant as CL_CI_CATEGORY_WRAPPER is not an active check. This check does not seem to exist so we cannot activate it?
Our end goal is to setup an common ATC-variant across multiple cloud and on-premise systems to standardize our checks across all systems. So we're looking for a way to export-import the same setup regardless of the system.
Any advice on how to proceed?
Kr,
Arne
Hi Arne,
are you using the latest ADT client 3.34?
Regards,
Thomas.
Hi Thomas,
Thanks, that was indeed the issue. We were using 3.32.
After an update to 3.34 we were able to create check variants via ADT on an S4/HANA 2022.
Kr,
Arne
Hi Olga,
I am getting an error while activating one of my custom checks, in a custom ATC check variant.
Error with ATC check variant
Regards,
Harish
Hi Harish,
if you want to get help on that, please open a support ticket to the component BC-DWB-TOO-ATF and include the implementation of your custom check.
Kind regards,
Olga.