You are on page 1of 14

Code Inspector User Manual

Version 2 January 2002

Table of Contents
INTRODUCING THE CODE INSPECTOR ............................................................................ 2 CALLING THE CODE INSPECTOR............................................................................................ 2 RESULTS OF THE INSPECTION............................................................................................... 3 CHECKING SEVERAL OF YOUR OBJECTS ................................................................................ 5 CREATING AN OBJECT SET .............................................................................................. 5 SELECTING AN OBJECT SET ................................................................................................. 6 CREATING A CHECK VARIANT.......................................................................................... 8 CREATING AN INSPECTION............................................................................................... 9 ANONYMOUS INSPECTION .................................................................................................... 9 CREATING A NAMED INSPECTION ........................................................................................ 10 STATUS OF EXECUTION AND STATISTICS OF A NAMED INSPECTION ........................................ 11 APPENDIX.......................................................................................................................... 13 FURTHER POSSIBILITIES TO SELECT AN OBJECT SET ............................................................ 13 DECLARING EXCEPTIONS ................................................................................................... 13 ADMINISTRATION OF CHECKS.............................................................................................. 13 RESTRICTIONS IN CUSTOMER SYSTEMS ............................................................................... 13 LIMITATIONS OF THE CODE INSPECTOR ............................................................................... 14 SWITCH TO MODAL F4 HELP ............................................................................................... 14 COMMENTS AND FEEDBACK ............................................................................................... 14

1

Reliability. Fig. ‘Function module’ or ‘Class’ (see figure 1). then a Check Variant with your special check. and Statistical Information Checks are performed on single objects or Object Sets (programs. Calling the Code Inspector The easiest way to call the Code Inspector for a single object is from ABAP workbench (SE80).1: Calling the Code Inspector for a class from SE24 (class builder) 2 . One or several single checks make up a Check Variant A Check Variant and one object/Object Set can be combined to an Inspection With the Code Inspector you can perform checks of different categories on single objects as well as on a set of objects. function builder (SE37). Security. For more elaborate checks on several objects you might first need to create an Object Set with your objects. or the class builder (SE24) with Object Check Code Inspector where ‘Object’ stands for ‘Program’. function module. or class) are then checked with a Default Check Variant of the Code Inspector. function modules.Introducing the Code Inspector Tool for checking static ABAP coding and DDIC objects (generally: TADIR objects) Aspects of checks are: Performance. The respective single objects (program. and at last a Named Inspection combing the two. A simple check of one object can be done with almost no preparation (see Calling the Code Inspector or Anonymous Inspection). ABAP editor (SE38). DDIC-objects). interfaces. classes.

syntax.Results of the Inspection When the Inspection run is finished. security. search. general Single check Type of result message: Error (red). Warning (yellow). Fig. which are ordered hierarchically. The system only displays the checks that were applied in the Inspection. you get the results of the Inspection.20) Message Each message contains: the source code position (or name of the TADIR object) a short explanatory text 3 . Information (green) Message code of sub-check (with Web AS 6.2: Results of an Inspection Hierarchy: List of checks Check category: Performance.

When this pseudo-comment is inserted into the coding. For further explanation click the information icon in front of the message. future Inspections will not show this message. with Web AS 6. You can change or delete your Default variant any time from the result screen or within transaction SCI. When started from the Workbench. 4 .To attain the inspected object double-click the message text. There is also given a pseudo-comment.20 you get two additional buttons on the result screen (figure 2): With the left button Create Default Check Variant you can create your local Default Check Variant. Fig. Your objects will be checked from then on with this local Default Check Variant.3: Information for a sub-check of ‘SELECT Statements that Bypass the Table Buffer’ An information text is available for many of the checks. providing an explanation of the problem and further links within the Code Inspector online documentation. With the button Code Inspector you get to transaction SCI.

5 . Create an Inspection and run it. use transaction SCI to Create an Object Set which contains your objects. Fig. but rather a number of objects. Creating an Object Set To create an Object Set call transaction SCI. enter a suitable name for your new Object Set and click Create. for example all objects of a package or a SAP component. This version number can help you to administrate Object Sets with slightly varying properties.Checking several of your objects If you want to check not only a single object.4: Create a new Object Set Each Object Set has a version number that the system assigns automatically. Create a new Check Variant which contains the checks you want to execute on your objects (or use a Default Check Variant).

You can immediately control your object list with Display Objects. If you set the flag ‘Selections Only’. If you use an Object Set without object list in an Inspection run. Using Free Obj. view. There are ‘local’ and ‘global’ Object Sets. This can be one of the following: Application Component (Web AS 6. structure/table. even if you choose an element (Inspection. While local Object Sets are only visible for one user (‘Person Responsible’). physical pool/cluster. Depending on your SAPGui settings. This can be done later by clicking on the Create Object List button. Be sure that for your selected object type already exists a check ! To save your selection and to create an object list. Groups. but no object list will be generated. 6 . Selecting an Object Set To select an Object Set with your objects. If you are not satisfied with your selection. you can always change the input and save the Object Set again. change. choose Save. choose TabStrip Select Object Set (figure 5). an up-to-date object list will be generated in this moment. or Check Variant) with F4 Help. In the upper part (Object Assignment) you can select objects according to their assignment. Object Set. delete and copy Object Sets. TabStrip Classes. and type-pools. The TabStrip Programs allows for a very general program selection and should only be used by expert users. allows you to select specific classes.. you get a list of Object Sets. Func. function groups. you will have to click on the local/global icon to switch between the two settings. table type). Proceeding this way. no outdated state of your object selection will be checked. programs or reports. See how to let F4 Help switch automatically to the local/global icon.20) Software Component Package Original system Person responsible In the lower part (Object Selection) you can select the objects. DDIC types (data element. global Object Sets can be viewed by everyone.. your selection criteria will be saved. With transaction SCI you can of course also display.Using F4 Help. interfaces. Choice you can select any TADIR object type (for example ‚TABL’ for tables).

20 a default description is generated containing the name and version number of the Object Set. Note that the default value lies 50 days ahead. user HOLMES selected an Object Set which contains the classes and interfaces of package S_CODE_INSPECTOR. 5: Selecting an Object Set with all classes / interfaces belonging to package ‘S_CODE_INSPECTOR’ See also: Further possibilities to select an Object Set 7 .In figure 5. Fig. You can also determine a deletion date. With Web AS 6. You can assign a description to every Object Set. This means as standard your Object Set will be deleted after 50 days if it is not included into an Inspection not yet executed.

Creating a Check Variant Check Variants are also created. If you create a local DEFAULT. SE37. or SE80. changed. Note Some checks have attributes. Attributes on the Pop-Up screen are selected by choosing Execute.20 it is not possible to save Check Variants with missing attributes. deleted and copied with transaction SCI. You obtain a tree containing all check categories with their respective single checks. displayed. if none of their attributes are set. For more information on a check. Some checks (for example the search functions) will not be executed. SE38. it will override the global DEFAULT Check Variant. These attributes can be set by clicking on the arrow in front of the check name. Fig. Add single checks to your Check Variant just by clicking the tree. choose the Information button. enter a suitable name and click Create. 6: Create a new Check Variant. Select single checks and maintain their attributes There is always a global Check Variant with name DEFAULT which is applied to the objects that are inspected from SE24. To create a Check Variant. 8 . With Web AS 6.

the checks of the Check Variant inspect the objects. it can only handle Object Sets with less than 50 objects and is executed on the local server. Inspections can be Anonymous or Named: An Anonymous Inspection is not stored persistently. You can create suitable server groups with transaction SM59 RFC Groups.7: Anonymous Inspection with single object and temporarily defined Check Variant 9 . When you click the Execute button. and a Check Variant.Creating an Inspection An Inspection consists of an single object or an Object Set. You can then combine an Object Set or a single object with an existing Check Variant (Predefined) or one picked spontaneously from the tree of checks (Temporary Definition). A Named Inspection is stored persistently together with it’s results. Fig. Anonymous Inspection In transaction SCI in the Inspection area click on Create without giving a name. It can handle Object Sets containing any number of objects and is executed on the local server or alternatively by a server group. In the Inspection run. the Inspection will be executed immediately on the local server. Finally you get the Results of the Inspection. A Named Inspection can be scheduled in an background job.

When choosing Execute. you can access the results by choosing Results. the Inspection run will be started immediately on the local server in one task. Clicking the Repeat button enables you to change the input parameters for an Anonymous Inspection. The results of the old Inspection are lost. 10 .When the Inspection run is finished. You can then combine an Object Set. or objects from a request with an existing Check Variant. You can start the Inspection immediately or you can schedule it in a background job.).. Creating a Named Inspection In transaction SCI type in a name for your Inspection and click Create. Note: All results of an Anonymous Inspection will be lost when you leave the screen Inspection. but you do not need to call the transaction SCI again and repeat all of your inputs to start a new Anonymous Inspection. There are two possibilities to execute the Named Inspection: on the local server or by a Server Group.8: A Named Inspection can be executed by a server group (Execute.. Fig. a single object.

From the Inspection screen you get to the statistics with the Statistics button. You can start a Named Inspection immediately or you can schedule it in a background job. Status of execution and statistics of a Named Inspection A Named Inspection can be in different states which are signalled by the status icon in front of it‘s name: An Inspection can be interrupted due to server shutdown. lack of resources. The Inspection will then be performed parallel in up to 12 tasks on all servers of the server group (if they have free resources). The load will be split up into packages of 10 to 50 objects. and the Code Inspector then tries to check the remaining objects. 11 . Especially in the case of a broken Inspection. you get to the ‘Execution Options’ Pop-Up screen where you can select a server group. with SM59 RFC Groups) you get directly into the server group maintenance. With the button Maintain Server Group (or.If you choose Execute. An broken Inspection can be (re-)started just as an Inspection not yet executed.. Make sure that the group contains only active servers that have sufficient free resources. alternatively. We recommend you to run the Inspection on a Server Group when the Object Set is large (more than 50 objects). In some cases it may not be possible for the Code Inspector to check all objects. so the Inspection will remain in the broken state. you will be interested in the execution statistics of the Inspection to get an hint about what went wrong. faulty checks. or other reasons. Therefore it is possible to get the results also for broken Inspections..

8: Statistics of execution of a Named Inspection Under Object Statistics you find a summary of the execution states for the checked objects. but there was no message Checked with message: object was checked and there is at least one message Lead to an error: an error occurred while checking the object 12 . cumulated runtime. Objects can have one of the following states: Not to be checked: object belongs to Object Set. tasks. Fig.The statistics inform you about start and end time/date of execution. execution state of the objects and errors. and objects. number of servers. but the Inspection executed has no appropriate check for the object Not yet checked: object has not been checked because the Inspection was interrupted Checked w/o message: object was checked.

20. Again filtering according to the attributes ‚Object Type‘. Restrictions in customer systems In customer systems only objects developed at the customer site can be put into an Object Set and checked in an Inspection. Exceptions for DDIC objects can be declared in table SCIEXCEPT. ‚Package‘ and ‚Responsible‘ Object Set from Result: objects that triggered messages can be input for building a new Object Set.Appendix Further possibilities to select an Object Set Additionally to selecting Object Sets from the scratch you have more options. Additionally. However. such as: Edit Object Set: Objects Sets can be united or intersected with others and filtered according their attributes ‚Object Type‘. with Web AS 6. create your local ‘DEFAULT’. On this screen you can activate or deactivate single checks and check categories. Object Set from Request: Object Sets can also be extracted from requests/tasks and filtered according the attributes ‚Object Type‘. You will find the appropriate comments in the online documentation of many of the checks. but in the moment this is not supported by the Code Inspector transaction SCI. Some global Check Variants (‘DEFAULT’ and ‘CHECKMAN‘) can only be changed with special authorisation. ‘Warning’. Changes executed herein will modify the displayed Check Variant tree. it is possible to check a single SAP object within the first 7 days after it has been modified. ‚Object Name‘. If you want the Code Inspector to check your objects from workbench with your own Check Variant. or ‘Information’) is possible. Some checks may have objects as message parameters (for example database tables used in programs) that can be extracted into a new Object Set when activating the Flag ‚Object Set from Parameters’ . 13 . you have the possibility to declare it as ‘Transportable’. and message type (‘Error’. ‚Object Name‘. which means that it can be transported and reused through the entire transport landscape. Declaring Exceptions You can declare exceptions by the use of pseudo-comments in your coding. When you create a global Check Variant. ‚Package‘ and ‚Responsible‘ is possible. Administration of checks In transaction SCI choose from the menu GoTo Test Administration. ‚Object Name‘. This will override the global one. ‚Package‘ and ‚Responsible‘. Only main objects (with TADIR program-ID ‘R3TR’) will be put into the new Object Set. filtering according to one single check and it’s message codes.

6C/4. Code Inspector for release 4.6C Code Inspector has been ported down to release 4.6C/4. Important limitations of the 4.6D version of Code Inspector are: Only English and German language versions available Since we started downport of the Code Inspector before end of Web AS 6. Answer Pop-Up screen ‘Deactivate ActiveX search help support ?’ with ‘Yes’.. please send them to Randolf Eilenberger 14 .6D Comments and Feedback Both are highly appreciated.. (Randolf. or SE80) with the DEFAULT check variant Pseudo-comments are not working Pseudo-comments to hide messages from Code Inspector will not work on release 4.Limitations of the Code Inspector The Code Inspector currently has the following limitations which you have to bear in mind when you use the tool: Code analysis only for static source code WHERE clause of a SELECT statement can only be parsed correctly when formulated in disjunctive normal form (which is the recommended form anyway) DB-Views and ABAP JOINs can not be handled ‚hidden‘ LOOPs in called modules can not be detected Switch to modal F4 Help How to let F4 Help switch automatically to the local/global icon (Switch to Dialog/modal Display of F4 Help) From the menu choose Help Settings.com). SE38.6C/4.6D and can be downloaded from sapservX by interested parties. On TabStrip F4 Help under ‘User-specific settings’ choose ‘System defaults’ for Settings and under ‘System defaults’ choose ‘Dialog’.Eilenberger@sap. only English and German language versions are available No integration into workbench It is not possible to check single objects from workbench (SE24.20 development. SE37.