I could not find this information in detail on the internet yet, and I think it is quite useful to know, so here is a quick description.
If you are the person responsible for ATC checks, and you want to use an SAP provided check (for example in automatic checks during release of transports), but you want to disable the possibility for the developers to use a pragma or pseudocomment, you can do this quite easily by creating a subclass to the respective SAP test class.
For example, we do NOT want the developers to call obsolete functions. We also do not want to allow the “workaround” of using a pseudo comment or pragma (FM_OLDED/FB_OLDED) that the SAP standard check allows.
This check is part of test class CL_CI_TEST_EXTENDED_CHECK.
So, we create a subclass of that class:
CLASS zcl_ci_test_extended_check DEFINITION PUBLIC INHERITING FROM cl_ci_test_extended_check FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ci_test_extended_check IMPLEMENTATION. METHOD constructor. super->constructor( ). myname = 'ZCL_CI_TEST_EXTENDED_CHECK' ##NO_TEXT. description = description && ' (fewer pragmas)'(001). MODIFY scimessages FROM VALUE #( pcom = c_exceptn_imposibl ) TRANSPORTING pcom WHERE pcom = 'FM_OLDED'. " obsolete function module ENDMETHOD. ENDCLASS.
In the constructor, we modify the standard table of checks scimessages. We change the field pcom (pseudo comment) for the respective test.
After creating and activating the class (don’t forget to create the text element 001), we need to enable it for ATC/SCI. This is done vie transaction SCI, menu: Code Inspector / Management of / Tests. At the end of the list, you should see your new Z class. You have to tick the checkbox on the left, then save.
Now the new check is available when you create or change check variants.