Chapter 9. Code Inspector

In this chapter, we will see recipes related to the Code Inspector tool. We will look at:

  • Carrying out quick code inspection
  • Carrying out a full-fledged inspection
  • Carrying out database-specific performance checks
  • Suppressing messages using pseudo comments
  • Searching for ABAP statement patterns and tokens within code
  • Creating your own Code Inspector checks

Introduction

The Code Inspector allows you to check your program for consistency, performance, and quality. It also allows you to search for patterns of ABAP statements or tokens within a program. The variable-naming convention adherence may also be verified. Unlike SQL trace and SAT tool, the Code Inspector does not execute the program. It only checks the syntax, and some times, depending on the checks selected, refers to the dictionary attributes of the table(s) involved.

Some of the categories of checks are shown as follows:

  • Performance
  • Security
  • General
  • Syntax
  • Robust Programming
  • Search Function

For programs, the simplest way of running the Code Inspector is to use the Menu option and go to Program | Check | Code Inspector. However, you do not have control over the checks carried out through this Menu option. The default variant DEFAULT is executed and the set of checks contained within it are run. Moreover, only one program at a time may be inspected through the Menu option.

This chapter explores useful recipes related to the Code Inspector. We will start with the simplest method for running inspections on one program or a small number of programs. Then, a full-fledged inspection with further options such as inspection saving and background execution will be discussed. Next, we will focus on the performance checks and the various cases they generate messages in the inspection results. Search functions and the procedure for suppressing messages in exceptional cases will also be discussed. Finally, we will see how we can create our own checks and add it in the list of standard checks.

For simplicity sake, I will use the term programs throughout the chapter when inspection is involved. However, other repository objects may be included in the inspection for checking purpose.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.170.187