You are on page 1of 7

Code Inspector

Code Inspector
Features
The Code Inspector is a tool for checking static ABAP coding and DDIC objects (i.e. generally all objects of the Object
Repository) under aspects of functional correctness, performance, security, reliability, and statistical information.
It helps developers to adhere to programming standards and guidelines by creating messages on less-than-optimal coding.
The Code Inspector offers various possibilities to define object sets and to combine multiple single checks in so-called
"check variants". These functions, and the tool's parallel processing framework, make the Code Inspector a flexible and
effective development assistant.
The Code Inspector can be used in various scenarios with different types of checks, thus providing insights into the code
quality from various angles.
Usage scenarios
1.

Single object checks from the Development Workbench


You can check a single object with the Code Inspector from the ABAP Editor (transaction SE38), the Function Builder
(transaction SE37), the Class Builder (transaction SE24), or the ABAP Data Dictionary (transaction SE11). To do this,
choose <object> > Check > Code Inspector from the menu, where <object> can be a program, function module, class, or
table. The respective single objects are then checked with a default check variant.

2.

Checks on transport objects from the Transport Organizer


You can invoke the Code Inspector from within the Transport Organizer (transaction SE09) to check objects in a transport
request. To do this, choose Request/Task > Complete Check > Objects (Syntax Check).

3.

Checks on sets of objects from transaction SCI


The Code Inspector (transaction SCI) itself enables you to create a wide range of object sets using standard selections via
package, software and application component, source system, transport layer, responsible, object type, object name and so
on.
In addition, special object collectors are available that allow you to read objects from a file, for example.
An object set can be combined with a check variant to a so-called "inspection" that can be executed in a single process or in
parallel. For a more details see Code Inspector User Manual
Types of checks and check variants
Below is a short extract of the types of checks and functions that are offered by Code Inspector. New checks can be
implemented if required, see for example Code Inspector - How to create a new check.

ABAP Test Cockpit

Syntax
Syntax check; extended program check

Performance
Analysis of WHERE clauses for SELECT, UPDATE and DELETE; SELECT statements that bypass the table buffer; Low
performance operations on internal tables ; table attributes check

Security
Usage of critical statements; dynamic and cross-client database accesses; use of ADBC-interface

Robustness
Check of SY-SUBRC handling; suspect conversions; activation check for DDIC objects

Programming Conventions
Naming conventions

Search Functions
Search of ABAP tokens; search ABAP statement patterns; search for ABAP statements with regular expressions

Metrics and Statistics


Program complexity test; statement statistics
You can combine any of these single checks into so-called "check variants", for example to check for the adherence to given
programming guidelines.
Best Practices
Developers can use the Code Inspector to support their everyday work. For example, the search functions or metric checks
of the tool can be a great help when restructuring the code.
The Code Inspector allows developers to define which objects are to be checked and which quality aspect of the code is to
be inspected (e.g. performance, security).
It is also possible to define global check variants as general programming guidelines, to ensure standardized programming
within a development community. Check variants can prescribe for example naming conventions or other rules. The global
check variants 'DEFAULT' and 'TRANSPORT' inspect objects in the development workbench and in transport requests,
respectively. These check variants contain SAP-defined settings, but can be modified as needed.
Another global check variant delivered with every SAP system is 'PERFORMANCE_CHECKLIST' which helps to detect lessthan-optimal coding with regard to application performance.

Extended Program Check


Introduction
The extended program check performs a complete check that includes the interfaces of external procedures called from
your program, for example, checking whether the number and type of the interface parameters in an external procedure call
is correct.
The extended program check is also only a static check. It cannot eliminate all of the circumstances that could lead to
exception situations or runtime errors. For example, any statements in which you specify arguments dynamically as the
contents of fields, or in which you call procedures dynamically, cannot be checked statically. To start the extended program
check

Go to transaction SLIN, specify the program name and click on

Select the relevant program in the object list and choose Check -> Extended Program Check from

the Program menu.


It is important to check all boxes (F6) to verify all possible problems, then choose run (F8).
It will appear to you a screen like this:

Errors numbers are in red, warnings in yellow and messages in blue.


Pay attention to Errors, because there will be potential dump errors. Examples: comparing fields with different type, number
of with parameters in a message, obligatory FM parameters not filled or with wrong type.
Warnings and messages are important too, but in minor impact, does not affect the performance at all. Example: variables
declared but not used, text pool not created.
Do you think that you are an exceptional programmer? This screen can be revealing... When we are writing code, is normal
to forget some things, like to declare variables and use it, test and remove the code but forget to remove the declaration...

Some topics and what they do

1.

Test enviroment - verify if the program is active. The Extended Check verify only active programs.

2.

Call Function interfaces - verify if the parameters' type is correct, the using of exceptions.

3.

Obsolete statements - Verify obsolete statements...

4.

Character strings - Verify if the used text pool was created

5.

Problematic Semantics - It shows to you better codes, like "WRITE TO can be replaced by more efficient MOVE
TO"

6.

Syntax check warnings - Pay attention to use conversion functions to compare fields. Or it will be listed in syntax
check warnings' topic... and select statements are verified too.

7.

Message - verify the number of with fields of message number

How to correct the errors/warnings/messages


Double click in the topic error, and you will see the full description:

In this example, the form f_validade was declared but not called in the program. Sometimes, in interface programs (BAPIs
for example) you need to create forms that the BAPI will call it. This error message will appear, but you will not need to
correct it, of course.
Double click in the message and you will be redirected to the code. Then, do the needed changes, active your program and
do the Extended Check again!

ABAP Test Cockpit


ABAP Test Cockpit
Features
The ABAP Test Cockpit (ATC) is an ABAP check toolset which allows running static checks and unit tests for your ABAP
development objects. The ABAP Test Cockpit can integrate tests written for the Code Inspector to enable reuse of existing
checks and check variants in the ABAP Test Cockpit. The ABAP Test Cockpit is directly integrated into the ABAP workbench
as well as in the ABAP Development Tools for Eclipse and allows checking code from just within the development
environment the ABAP developer is used to. Working with the ABAP Test Cockpit as a developer is easy and efficient with
the new ABAP Test Cockpit filter, navigation, and re-check functionality. Team leads and quality engineers will like the ABAP
Test Cockpit because it introduces new quality assurance processes like quality gates, a robust exemption approval
process, email notifications on errors and exemption workflow events, and periodic regression tests in a quality system. In
addition, the ATC offers tools to analyze the ABAP Test Cockpits results on team or component level. The integration of the
ABAP Test Cockpit into the SAP Solution Manager allows cross system quality reporting.

Usage scenarios
1.

Check single object from the Development Workbench


You can check a single object with the ABAP Test Cockpit from the ABAP Object Navigator (SE80), ABAP Editor (transaction
SE38), the Function Builder (transaction SE37), the Class Builder (transaction SE24), or the ABAP Data Dictionary
(transaction SE11). To do this, choose <object> > Check > ABAP Test Cockpit (ATC from the menu, where <object> can be
a package, program, function module, class, or table. The respective single objects, in case of a package, the objects of the
package, are then checked with the default check variant.

2.

Check multiple objects from the Development Workbench


You can check multiple objects with the ABAP Test Cockpit from the ABAP Object Navigator (SE80), ABAP Editor
(transaction SE38), the Function Builder (transaction SE37), the Class Builder (transaction SE24), or the ABAP Data
Dictionary (transaction SE11). To do this, choose <object> > Check > ABAP Test Cockpit (ATC) with from the menu. You
can now add other objects to the list of objects to be checked via drag and drop. You can also select the check variant to be
used and whether the checks shall be run in foreground or in background.

3.

Checks on transport objects from the Transport Organizer


You can invoke the ABAP Test Cockpit from within the Transport Organizer (transaction SE09) to check objects in a
transport request. To do this, choose Request/Task > Check Objects.

In addition checks can be invoked automatically on release of a transport. This way, you can disable transports not matching
your quality criteria from being sent to further systems.
4.

Schedule checks from transaction ATC


The ABAP Test Cockpit allows to run preconfigured tests on a regular basis. The selection of development objects to be
checked can be based on a pick list or an object selection which is evaluated at the time the checks are run. As the basis for
the object selection, you can define a list of packages, transport layers, software components or object sets defined with
code inspector. This allows to include also newly created development objects without having to reconfigure the scheduled
run. You schedule within the transaction ATC by ATC Administration > Runs > Schedule Runs.

You might also like