You are on page 1of 3

Improving the Quality of Your ABAP Code Using the Code Inspector

Below is a snippet from one of hundreds of articles available to ERPtips subscribers.


If you would like a complimentary copy of the full article, please email
Mark.Downs@ERPtips.com
(include the title of the article in your email)

To subscribe to ERPtips, go to
www.ERPtips.com/Subscribe.asp.

ERPtips Journal is published by Klee Associates, Inc.


ERPtips University provides both public and onsite training for SAP clients.
For more about ERPtips University, including the current schedule, click here:
www.ERPtips.com/WorkshopSchedule.asp

Improving the Quality of Your ABAP Code Using the Code Inspector

As an ABAP developer, you know the value of optimizing your existing code as well as learning
tips & tricks to generate more efficient code. Rehan explains how to utilize SAP`s ABAP Code
Inspector to check repository objects, security, syntax, & naming conventions. Conducting an
inspection of this type will help you identify potential coding flaws and identify unnecessary or
redundant tasks that would add processing time to your routines. Rehan presents an overview of
the Code Inspector & demonstrates how to call it using either a transaction code or a menu path.
He describes the types of errors the Code Inspector may identify, & explains the hints it may
suggest for improving the ABAP code.

Click here to read this Snippet


SAPtips4On ABAP/J2EE
Page 3

June/July 2006 Volume IV Issue 3

In this case, if there is no


DEFAULT Variant defined
for your user, the system uses
the global Variant DEFAULT
while carrying out the inspec-
tion.

Calling the Code In-


spector with Transac-
tion SCI
As already mentioned,
there are two ways of call-
ing the Code Inspector for
checking your ABAP code.
The more powerful option
is using the transaction code
SCI. The main screen of this
transaction is shown in Fig-
ure 5.

Before creating an inspec-


tion, you need to define
a suitable Object Set and
Check Variant. Enter a suit-
able name for your Object Set
and then click on the Create
Figure 5: Code Inspector -- Main Screen of Transaction SCI
icon. This takes you to the
screen shown in Figure 6.

Enter a description for


your Object Set. You also
need to enter suitable values
in the Object Assignment and
Object Selection areas. The
Object Assignment area lets
you define your selection by
specifying the user who cre-
SAPtipsJournal

ated the objects in question,


or on the basis of the applica-
tion ID, software component,
and package. For example, if
you’d like to specify a set of
objects created by the user S_
JONES, you should enter the
same in the Person Respon-
sible field.

Figure 6: Defining an Object Set

SAPtips.com SAPtips © 2006 Klee Associates, Inc.


SAPtips4On ABAP/J2EE
Page 4

June/July 2006 Volume IV Issue 3

The Object Selection area is


used to specify the programs,
classes, and function groups
that you want to include in
your selection. On the Class-
es, Func Groups tab, enter
the criteria for selecting the
object that you would like to
check. For example, if you
would like to select all pro-
grams that begin with the let-
ter Z, you should enter Z* in
the Program field. When you
have specified your selection,
save your entries by clicking
the Save button.

Next, you need to create or


choose a suitable Variant for
your inspection. On the main
screen of transaction SCI
(Figure 5), enter a name in
the Check Variant field, and
click the Create button. This
takes you to a screen similar
to the one shown in Figure
7.

Specify a suitable name


and description for your Figure 7: Creating and Executing a Check Variant
Variant. This screen displays
the entire range of checks
and functions available in the
Code Inspector. Use the checkboxes immediately. When the inspection is played. The output of the inspection
to select the checks that you want to complete, a message “The Inspection is then displayed, as shown in Figure
include in your program Inspection. was carried out successfully” is dis- 9.
SAPtipsJournal

Finally, you have to create


and execute an inspection for
your specified objects. On
the main screen of transac-
tion SCI, enter an appropri-
ate name for your inspection,
and click the Create button.
The screen appears, as shown
in Figure 8.

On this screen, enter the


name of your newly cre-
ated Check Variant, and the
Object Set, in the fields pro-
vided. Then, click the Execute
button to start the inspection Figure 8: Creating and Executing the Inspection

SAPtips.com SAPtips © 2006 Klee Associates, Inc.

You might also like