Additional Blogs by Members
Showing results for 
Search instead for 
Did you mean: 
Active Participant

What is Code Inspector?

The Code Inspector is a tool for checking Repository objects.

Using the Code Inspector, we can check individual objects or sets of objects for performance, security, syntax, and adherence to name conventions.
In the Code Inspector, you can define inspections that, with the help of check variants, examine certain sets of objects.
As the result of an inspection, you receive information messages, warning messages, or error messages on different properties of the examined objects

The concepts are explained in the blog by Nick Young Setting up and using the SAP Code Inspector.
In this blog we see the step-by-step tutorial for using Code Inspector.

The summarized basic concepts are as below:

What is Check Variant, Object Set, Inspection in the context of Code inspector? 

  • Check Variant – This defines the rules to be applied, which checks are to be made and the settings of those checks. 
  • Object Set – This defines the development objects that will be included. 
  • Inspection – This defines a combination of Check Variant and Object Set, in other words what checks are to be applied to which development objects.

What is the difference between local and Global Check Variants? 

  • Global elements are available to all users.
  • Local elements are associated directly with a specific user id.
  • SAP provides a Global Check Variant with the name ‘DEFAULT’. This is used for objects that are checked from the context menu of Programs, Classes, Function modules etc.
  • For your username, If you create a Local Check Variant with the name DEFAULT, the system will use this instead of the global check variant.


Step-by-step Tutorial

Task 1)Browse the Global ‘DEFAULT’ check variant.

The Global DEFAULT check variant will be displayed as shown below:

Let us not change the Global DEFAULT check variant.

Task 2) Create Local DEFAULT check variant.

Let us create a Local DEFAULT variant (for the logged in user) by copying from Global DEFAULT variant.

  - -

Save the Local DEFAULT Check Variant.


Here onwards whenever you use the Code Inspector from a context-menu of a program, Function module, Class, etc, the local DEFAULT variant is used (instead of the global DEFAULT variant) for examining the code.

Task 3) Create a Sample program and examine with (local) DEFAULT variant of code inspector.

Create a program ZTEST_ONE.

if needed, you can copy from below textarea:


After activating the program, execute the code inspector as shown below.


The Results will be displayed as under:

The warning messages show that naming conventions are not followed for the names spfli_table, alv_obj, alv_exc_obj and row_count.


The ‘DEFAULT’ check variant enforces the rule “Global data declarations in program must be prefixed with letter G followed by letter corresponding to type of the data - T for internal tables, O for object references, X for exception objects, E or V for elementary types.

So the names in our sample program should begin with gt_*, go_*, gx_*, gv_* or ge_* based on their types.


Go to the program and make changes as shown below:


Execute the code inspector.



Task 4)Create a non-DEFAULT check variant.

Create a new Code Inspector Check Variant (non DEFAULT).


Save the variant.


Task 5) Validate the sample program against the newly created Non-DEFAULT Check Variant.

Create an ObjectSet.




Create an Inspection, and Execute.



The results will be displayed as shown in next screen.

  Correct the Program.


Activate the Program.

To run the inspection ZCI_01 again, we need to create a new version of the inspection ZCI_01.

Create a new version of Inspection:


Execute new version of Inspection.


You will see results as shown below:



Active Contributor
That's the simplest blog step by step about Code inspector, other ones present the same thing but are a little bit more general. Thank you for the reference you give, another one is the wiki ( which gives also other very interesting references.
Active Contributor
0 Kudos
Nice one, simple and clear explanation.