Showing posts with label SCII. Show all posts
Showing posts with label SCII. Show all posts

How to suppress messages during code inspection using pseudo comments?

Suppressing messages during Code check using pseudo comments in ABAP?


There are different ways of finding out whether a particular message may be hidden and the code for hiding such messages using pseudo-comments.

1. From the message results, navigate to the message to suppress.
2. Expand the folder icon to display its details.
3. Then, check the icon is displayed before the message as shown.





4. This will display the dialog box, as shown. This will inform you how the code can be handled.



5. Note the comment. This may be included in the coding with the statement that
generated the message as shown as follows:

SELECT * FROM ZDATABASE_TABLE.                "EC# CI_NOWHERE





How to improve performance by database checks in ABAP?

Database-specific performance checks by Code inspector

Use SCII or SCI transaction code

Within the checks, expand the Performance Checks category.

From the list of checks that appear, select the checks shown in the following screenshot:



During this, the code inspector checks the syntax of the program and refers to the attributes and technical settings of the tables involved.

  • CHECK or EXIT statements used within a SELECT statement instead of highlighting a WHERE clause.




  • SELECT statements included in a loop such as a DO loop or within a loop at ITAB.



  • Any SELECT statements that use the BYPASSING BUFFER addition.



  • SELECT statements that are without a WHERE clause will be included in the warning.

The following is one such example:

SELECT * FROM ZMYTAB INTO IT_TAB



  • Any table that is buffered but is included in a subquery will also result in a warning. This is because the buffering may not be used in this case, since the result of the subquery will be used at the database level in order to determine the selection set of the main SELECT statement.



SELECT FIELD1 INTO TABLE IT_FIELDS
FROM ZTAB1
WHERE FIELD2 EQ 'ABC' AND
FIELD3 IN ( SELECT FIELD1 FROM ZTAB2
WHERE FIELD2 EQ 'Z1' AND FIELD3 EQ'A'.)



  • If the ZTAB2 table is buffered, a warning message will appear in the result.






How to use Code Inspector in quick steps?

AdHoc Inspection for ABAP Program in Quick Method

We will see how we can do a quick code inspection on a single program or an
object set. This is also termed as an Ad Hoc Inspection, since the inspection results are not
saved and are not available for future.


1. Call the SAP transaction SCII. Alternatively, you may go to transaction SCI and on
the main screen, leave the Inspection field blank and press the Create button below
the Inspection Input field. The screen appears as follows:




2. Select the Single radio-button option. From the list box, select the Program option
and then enter the name of the program in the field provided. We enter the name
of a previously created program ZST9_TEST_FOR_ALL_ENTRIES_2.



3. From the area in the lower part of the screen, we will select the option Temporary
Definition. Then we select from the available checks that we want to be carried out.
Selecting or deselecting a particular category will include or exclude all checks within
the category in the inspection. For resetting to default values at any time, select the
menu path by going to Utilities | Set Initial. Alternatively, use the toolbar button
or press F7.



4. Finally, press F8 to carry out the inspection.


The code of the program mentioned is scanned and checked based on the selected checks.
The results are then displayed. The results comprise of tree structure (hierarchy) within nodes
corresponding to the checkbox selected. There are three columns shown for messages within
the different categories and then the checkboxes pertaining to the category in question.
These are Errors, Warnings, and Information messages. You may open the various
categories to see the detail of the messages found in each category. For example,
we have two information messages found under Use of Indexes in SELECT statement.





You may double-click on a particular message to reach the actual line of the code in the
program that generated the message in question.

While selecting the checks to be run from a particular category, a check may have further
attributes. This is denoted by the icon before it. You may click on the icon to view a list of
the attributes and choose the ones relevant for your requirement. If you find an icon, it means
that there is at least one value that must be set for the attributes contained within the check.
Otherwise, selecting the check will produce an error and the inspection will not run.



For running another inspection from the results screen, use the toolbar button .

For viewing the results in a compact display format, use the toolbar button .  


You have also the option of checking objects using object sets or the object contained within a
request. However, the transaction has a limitation that you may not check over 50 objects and
that the inspection may not be saved for reuse. In this case, the inspection is not stored and
does not have a name (that is, it is anonymous). The next recipe will cover the ones that will
overcome these limitations.