Skip to Content
Technical Articles
Author's profile photo vivek gupta

Standard way to add custom test cases in ATC

Adding custom test cases to ATC


There are situations where ATC might not be considering all the checks and your coding standards demands additional checks to be incorporated inside the ATC checks.

Hence adding custom checks to ATC is the only option you are left with (if you don’t want to purchase Code Vulnerability Analysis (CVA) license from SAP where additional checks are also incorporated like SQL injection etc.)

Following are the steps to add new test cases to ATC.

  1. Create a template in SCI where you can put together your additional checks
  2. Create a new class for each test case
  3. Set the attributes of the test cases
  4. Set the message code of the test cases.
  5. Set the priority of the test cases


Let’s follow the best practice (standard way) to add custom checks in ATC (steps mentioned below).

SAP has provided many classes which can be derived and used. We can inherit the classes and use its functions.

What I suggest is you should group the test cases into groups and create attributes inside each test cases. This makes design simple and by doing this we stick to the standards.

(Fig. no. 1)

Attributes inside check Analysis of select statements 

(Fig. no. 2)

E.g. Consider you have below test cases to be added to ATC:

  1. Select up to 0 rows
  2. Multiple identical SELECT Statements in the same Module
  3. Missing Authority check in RFC enabled function
  4. Dummy Authorization check

You can group all the select query checks together and all the authorization check together and create attributes inside each check. Your test cases will look like the one mentioned in above figure (fig. no. 2)

To achieve this, follow the below step by step guide.

Create template check:

Template check “GMI Additional test cases” in fig. 1

  1. Create class “ZCL_CI_CATEGORY_TEMPLATE_CR“ using se24 transaction
  2. Make this class as sub-class of class CL_CI_CATEGORY_ROOT

(Fig. no. 3)

  1. Create constructor method (you cannot redefine the constructor method), so that system replaces the existing constructor by your own constructor.
  2. Insert the below code inside the constructor method
  3. (Fig. 4)
  4. Activate the class
  5. Navigate to sci transaction and navigate to management of -> test and select your class as shown below:

(Fig. no. 5)


  1. Now if you check your variant it will contain your custom template check

(Fig. no. 6)


Now we want to add checks inside the template.


Create new class for each test case

  1. Create new class named “ZCL_SELECT_CHECK” using se24.
  2. Make this class as sub-class of class “CL_CI_TEST_SELECT_TAW “, so that you can use existing methods.
  3. You can check the already existing methods

(Fig. no. 7)


  1. Now you can use class attributes like “selct “and get all the select queries along with the index numbers, up to addition, where fields addition etc as shown below:

(Fig. no. 8)


  1. As you cannot redefine the constructor hence create the constructor method and it will replace existing constructor since class can have only one constructor.

Add below codes inside the constructor:

(Fig. no. 9)

Set the attributes of the test cases


  1. Redefine the QUERY_ATTRIBUTES method and add below code:

(Fig. no. 10)



  1. Redefine the get attributes and put attributes method for reading and setting the attribute values respectively.

(Fig. no. 11)


  1. Define the necessary attributes for holding the attributes values from sci transaction

(Fig. no. 12)




Also define the text elements

(Fig. no. 13)


  1. Activate the whole class.



Set the message code of the test cases.

Open transaction sci and choose the variant you want to configure.

You will notice there is no custom checks created

Now back to sci->management of->tests and select your class as shown below (as shown in fig. no. 5 above)


Now you will see custom checks appears inside below the template “GMI Additional test cases“


  1. Now redefine run method and write below code. Inside run method for select check you can easily apply your logic checking up to addition and where field addition of standard table selct (shown in fig. no. 8):

(Fig. no. 14)


  1. Now run the ATC on program to check the findings.


Note the priority of your custom test cases. We are going to change it in the next step.



Setting priority of the custom test cases:


For all the custom test cases or even the standard existing test case, you can change the priority by putting entries in table SCIPRIORITIES.

  1. Go to se11 transaction and open the table SCIPRIORITIES
  2. Now create entries inside this table as:

(Fig. no. 15)

  1. When you run ATC, it picks up the priorities for your custom checks from this table as shown below:

(Fig. no. 16)

You can do similar steps to incorporate Authorization check. Only difference is you can create sub-class of class “CL_CI_TEST_SCAN“. This class is the simple scan class and it has already scanned the code and stored in the variable statements and tokens.

(Fig. no. 17)

Please note there is no need to create template check if you don’t want. You can put your custom checks inside the standard checks as well. Just change the constructor method and you are good to go.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandra Rossi
      Sandra Rossi

      There's already this 2006 blog post Code Inspector – How to create a new check, by Peter Inotai.

      Author's profile photo vivek gupta
      vivek gupta
      Blog Post Author

      Yes Sandra but the steps specified above are with reference to the standards. Also it was not specified how to add attributes like we have for standard checks in the post you mentioned, hence I have put together the steps.

      Author's profile photo Sandra Rossi
      Sandra Rossi

      By the way, I profit of your initiative to add a link to the library of custom Code Inspector checks added by Lars Hvam here:, anyone can participate to propose new checks or enhance existing ones.

      Author's profile photo vivek gupta
      vivek gupta
      Blog Post Author

      Thanks Sandra.

      Author's profile photo Wail Fakih
      Wail Fakih

      Hello Vivek,

      Can you share your custom code. That could be a great help for our project.

      Best Regards,


      Author's profile photo vivek gupta
      vivek gupta
      Blog Post Author

      Hello Wail Fakih,

      Apologies for being little late on this. I have changed my organisation and now I don’t have access to the system.

      Would request to specify what issue you are facing, so that I can help you.

      Author's profile photo Amit Dilip Sawant
      Amit Dilip Sawant

      Nice blog Vivek , very useful.

      Author's profile photo Sahil Chugh
      Sahil Chugh

      Very Informative Post Vivek.

      Thank you for sharing the details.

      Author's profile photo Jay Dalsaniya
      Jay Dalsaniya

      Hey Vivek,
      Thanks for covering the steps in detailed manner. This has helped me a lot.

      In future if you do post any literature on the automation part to carry your work ahead, please mention it here, i have bookmarked it ?

      Author's profile photo Manish Gupta
      Manish Gupta

      Hi Vivek,

      How do you identify which class can be derived to achieve my desired functionality? There are a lot of classes if i search with CL_CI*.

      Have to used any other classes?

      Author's profile photo Gábor Márián
      Gábor Márián

      Check out this document about writing an own ATC (CI) check. It describes the purpose of the superclasses.

      Author's profile photo Manish Gupta
      Manish Gupta

      Thanks a lot!!