The power of the Code Inspector
In this blog I would like to talk about the “Code Inspector” tool and how it can be used to enforce naming conventions and coding standards in ABAP programs. The Code Inspector (transaction code SCI) is a very powerful tool which can be used to check individual objects or sets of objects for performance, security, syntax, and adherence to name conventions. You can also determine statistical information or search for certain ABAP words (tokens). 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. Steps 1. Go to SCI transaction.2.Creation of object set Give a name to the object set and select “create”. Object Set can be used to group several single objects together for an inspection. Sets of objects include, for example, programs, function groups, classes, or DDIC objects. In general, any Repository objects can be included in a set of objects.Here you can either include a entire package or individual programs. 3.Creating the Check Variant Give a name to the check set and select “Create” With the help of the check variant, sets of objects included in the object set are checked as to whether or not certain criteria have been met.This variant can be used to enforce performance checks,syntax checks,security checks,naming conventions and ABAP keyword searches.In this example I create a check variant for enforcing program naming conventions and ABAP Keyword searches. 4.Naming Conventions Click on the “naming conventions” node under the “programming conventions” node.A popup screen will be displayed as shown below where you can define the naming conventions for various ABAP objects. 5.Searching for ABAP tokens Click on the “Search for ABAP Tokens” under the “Search Functions” node.A popup window will be displayed in which you can specify any specific ABAP keywords to be filtered.In this example I am searching for the ABAP keyword “LIKE” which I don’t want to be used in any of the checked programs. 6.Attaching the object set and the check variant to the code inspector Now come back to main screen in SCI and create a new code inspector by selecting “create” under the “inspection” frame.Here you attach the “object set” and “check variant” created in the earlier steps.7.Save and Click the “Execute” button to generate the result. 8.Click on the “results” button to view the result You can double click on the results to go to the main program. 9.Test program for checking naming conventions enforced in check variant.