Clean ABAP code ATC variant

Clean ABAP is the ABAP variant of the clean code principles. All background on clean ABAP code can be read in this blog.

This blog will explain how to upload the ABAP coding for the Clean ABAP ATC variant in your system and activate it.

Load ABAP Git code

To load the ATC variant code for clean ABAP you first need to install the ABAP Git code. Follow the instructions in this blog to do so. Simplest is the offline variant.

Download the ABAP clean code package

Now go to the Github code pal site for ABAP clean code and download the package:

Select the button Code and choose the option Download ZIP.

Upload the package

Now start the ABAP git that you loaded in your first step. Choose the option New Offline:

Give the repository a name and select a package:

Then push the button Create Offline Repo.

Now select Import Zip:

Import the file you downloaded in step 2 from the code pal site.

Next step is the Pull zip:

You might get a screen with differences. Do not select anything there, only press Ok.

Then wait until all the Y objects are pulled into the system. This might take 5 to 10 minutes.

Activating the SCI checks

Now start transaction SCI. Select menu option Code Inspector, Management of, Tests. Select all the newly load Y checks for Clean ABAP code:

Important now: Save them!

Now you can create a global SCI variant:

Select all the Clean code ABAP checks and save the variant:

You might get weird issues upon saving for other items, like for example missing CL_CI_CATEGORY_TOP. In that case, go to transaction SE16 -> look for table SCITESTS -> and look for CL_CI_CATEGORY_TOP if there is no entry. Enter the table SCITESTS and click "Create Entry", add CL_CI_CATEGORY_TOP entry and save.

Test and usage

Take a program you want check. Then select menu option Program, Check, ABAP Test Cockpit with….:

Select the ZCLEAN_ABAP SCI check we created above. Run the checks.

Results:

Tip: click on the blue line to jump to the Clean Code site exactly explaining about the issue.

Clean ABAP Eclipse plug-in: ABAP cleaner

To speed up clean ABAP in practice, you can install the clean ABAP cleaner plug-in. Read this blog on how to do this.

5 thoughts on “Clean ABAP code ATC variant”

  1. Hello
    Your saptechnicalguru blog is very good and helps me a lot, thank you very much !!!

    What are the best practices for custom code in the greenfield approach?
    I would like to take some of my developments into S4HANA and not implement from scratch in new S4Hana System.
    Can I only activate ATC in the source system or should I install a central CC check system?

    Which tool is then used to migrate the Custom Code to the S4Hana system?

    Thank you very much

  2. Hi, I get the following error when I try to save the tests

    Message no. SCI226
    Diagnosis
    The check category /IWBEP/CL_CHK_CI_CAT_GW was to be removed. However, at least one check, /IWBEP/CL_CHK_CI_DPC_CRP, is assigned to this category.
    System Response
    The check category /IWBEP/CL_CHK_CI_CAT_GW cannot be removed from the list of active checks and categories.
    Procedure
    First, remove the checks from the list that are assigned to the category /IWBEP/CL_CHK_CI_CAT_GW. The category itself can then be removed.

    1. Yes, you might get issues upon saving.

      First try to select all and save. Then unselect one by one the ones giving issue. That can work.

      Or check this one:
      You might get weird issues upon saving for other items, like for example missing CL_CI_CATEGORY_TOP. In that case, go to transaction SE16 -> look for table SCITESTS -> and look for CL_CI_CATEGORY_TOP if there is no entry. Enter the table SCITESTS and click “Create Entry”, add CL_CI_CATEGORY_TOP entry and save.

    2. You’re getting that issue because you must be using filter to have a list of only Y* checks. The catch is filters try to remove the ones not in refined results by the filter. So, don’t try using the filter.
      Sort the list alphabetically, select all the Y* checks manually one by one.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.