[go: up one dir, main page]

0% found this document useful (0 votes)
21 views17 pages

SAP Code Inspector (SCI) - Tutorial - SAP Community

The SAP Code Inspector (SCI) is a tool used for checking repository objects for performance, security, syntax, and naming conventions. The tutorial provides a step-by-step guide on how to set up and use the Code Inspector, including creating local and global check variants, and performing inspections on sample programs. It emphasizes the importance of adhering to naming conventions and offers practical tasks to validate coding standards.

Uploaded by

ANDRE DWI CAHYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views17 pages

SAP Code Inspector (SCI) - Tutorial - SAP Community

The SAP Code Inspector (SCI) is a tool used for checking repository objects for performance, security, syntax, and naming conventions. The tutorial provides a step-by-step guide on how to set up and use the Code Inspector, including creating local and global check variants, and performing inspections on sample programs. It emphasizes the importance of adhering to naming conventions and offers practical tasks to validate coding standards.

Uploaded by

ANDRE DWI CAHYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

19/02/25, 14.

40 SAP Code Inspector (SCI) – Tutorial - SAP Community

Community

SAP Community  Products and Technology  Additional Blogs by Members

 SAP Code Inspector (SCI) – Tutorial

Additional Blogs by Members


Blog  What are you looking for today?


SAP Code Inspector (SCI) Tutorial

jagdishwar_b
Active Participant

‎2011 Feb 11 3:21 PM

 22 Kudos  108,098

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?

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 1/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 2/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 3/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 4/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 5/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

if needed, you can copy from below textarea:

REPORT ztest_one. "declare all global variables. DATA: spfli_table TYPE


STANDARD TABLE OF spfli, alv_obj TYPE REF TO cl_salv_table,
alv_exc_obj TYPE REF TO cx_salv_msg, row_count TYPE int4. "get the
data from spfli table SELECT * FROM spfli INTO TABLE spfli_table WHERE
carrid = 'LH'. row_count = sy-dbcnt. IF sy-subrc = 0. "dislpay the resultset in

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

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 6/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 7/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 8/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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

Save the variant.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 9/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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

Create an ObjectSet.

Create an Inspection, and Execute.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 10/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

The results will be displayed as shown in next screen.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 11/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

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.

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 12/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

You will see results as shown below:

..

Tags:

jagdishwar b Retagging Required

2 Comments

Sandra_Rossi
Active Contributor
https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 13/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community


‎2011 Feb 13 3:09 AM

 1 Kudo

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 (http://wiki.sdn.sap.com/wiki/display/ABAP/Code+Inspector)
which gives also other very interesting references.


lakshminarasimhan_n4
Active Contributor


‎2021 Aug 01 3:00 AM

 0 Kudos

Nice one, simple and clear explanation.

Labels In This Area


ICM LOGFORMAT DELIMITER 1

Related Content
Joule speaks ABAP!
in Technology Blogs by SAP yesterday

Add Mass Excel Data Updates in any Standard SAP Fiori App Using the UI5
Spreadsheet Importer
in Technology Blogs by Members Monday

Tutorial: Creating Configurable Materials (KMAT) in SAP S/4HANA


in Technology Blogs by Members Friday

Calling SOAP Asynchronous Api In RAP ( Public Cloud )

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 14/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community
in Technology Blogs by Members a week ago

OUT NOW: SAP Signavio February 2025 Release - Explore the Features to Help
You Drive Transformation
in Technology Blogs by SAP 2 weeks ago

Popular Blog Posts

Are you there, SAP? It's me, Jelena

Jelena_Perfiljeva
Active Contributor

 20031  114  137

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 15/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

Integration Point of MM-FI-SD in SAP ERP

former_member183424
Active Contributor

 232797  13  75

SAP Project System - A ready Reference ( Part 1 )

former_member190313
Active Participant

 80848  29  73

Top Kudoed Authors

kevin_wilson2  1

View all

Privacy Terms of Use

Copyright Legal Disclosure

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 16/17
19/02/25, 14.40 SAP Code Inspector (SCI) – Tutorial - SAP Community

Trademark Support

Cookie Preferences

Follow

https://community.sap.com/t5/additional-blogs-by-members/sap-code-inspector-sci-tutorial/ba-p/12890305 17/17

You might also like