Sei sulla pagina 1di 7

Purpose of Code Inspector

Contents
1. 2. 3. 4. 5. 6. 7. 8. 9. General Checks ................................................................................................................................ 2 Statement Statistics ......................................................................................................................... 2 Performance Checks ........................................................................................................................ 3 Security Checks................................................................................................................................ 3 Syntax Check/Generation ................................................................................................................ 3 Programming Conventions .............................................................................................................. 3 Metrics and Statistics....................................................................................................................... 4 Dynamic Tests ................................................................................................................................. 4 User Interfaces ................................................................................................................................ 4

10. Search Functions.............................................................................................................................. 4 11. Application Checks............................................................................................................................ 5 12. Internal Performance Tests ............................................................................................................... 6 13. Internal Tests .................................................................................................................................... 7 14. Proxy Checks .................................................................................................................................... 7

Date: 30 Nov 2010

1|P ag e

Purpose of Code Inspector

1. General Checks
The category General Checks contains data formatting:

Table Names from SELECT Statements Creates a list of the database tables read statically in a program using the SELECT statement. (This list can be summarized).

Table Attributes Statistics Statistics of Table Properties This check supplies statistical information for tables based on the following criteria:

Table Buffering o Buffering not allowed / Buffering allowed, but switched off [Warning] / Buffering switched off o Single records buffered / Generic area buffered / Fully buffered Indexes o Only primary index / Number of secondary indexes Size Category o Not maintained [warning] / Size category of 0-9 Delivery Class o Delivery Class A / C / L / G / E / S / W Enhancement Category o According to DDIC error for classification [error] o Not classified / not enhanceable / enhanceable and character-type / enhanceable and character-type or numeric / can be enhanced as required

2. Statement Statistics
These statistics count the statements contained in the program objects. Comments, in contrast to macro definitions, are counted also. The display option 'Sort' allows summarization of the result for the set of objects (= 'No' sorting), person responsible, or package. The non-summarized result comes up if you have sorting by 'Object'. The statement statistics contain the following parameters: Only Operative Statements The number of operative statements is determined - that is, declarative statements such as data or object declarations are not counted. For Each Modularization Unit The statistics are split up according to statements in the modularization units (dialog module, form routine, function module, method) and according to statements outside of such units. Without Multiple-Used Statements If this parameter is not set, the statements of all the Includes used in a program object are counted as well. Since Includes can be used as often as desired, this results in multiple counts. If the parameter is set, the statements of Includes that are included throughout the system in more than one program are not counted.

Date: 30 Nov 2010

2|P ag e

Purpose of Code Inspector

3. Performance Checks
The category Performance contains checks for performance and resource use. Analysis of WHERE Condition for SELECT Analysis of WHERE Condition for UPDATE and DELETE SELECT Statements that Bypass the Table Buffer SELECT Statements with Subsequent CHECK SELECTs in Loops Changing Database Accesses in Loops Nested Loops Performance-Intensive Operations on Internal Tables Performance-Intensive Parameter Passing EXIT Statement Within a SELECT/ENDSELECT Loop Table Attributes Check

4. Security Checks
The category Security contains checks for critical statements, cross-client queries, authority check shortage, and so on.

Critical Statements Dynamic and Client-Specific Accesses Using SELECT Dynamic and Client-Specific Accesses Using INSERT, UPDATE, MODIFY, DELETE Handling SY-SUBRC Changing Database Accesses Outside Update Modules Client-specific shared object methods

5. Syntax Check/Generation
The category Syntax check/generation contains checks for ABAP syntax check and generation: Syntax Check Extended Program Check Generation of Programs

6. Programming Conventions
The category 'Conventions' contains checks for programming conventions ABAP naming conventions This check examines whether objects such as types, classes, fields, and so on, defined in an ABAP program adhere to the name conventions specified using the test parameters.

Date: 30 Nov 2010

3|P ag e

Purpose of Code Inspector

7. Metrics and Statistics


The checks of category Metrics and Statistics examine objects with regard to code metrics and statistical information. Number of Executable Statement Statistics Metric of executable statements, that is without declarative statements. Also the number of comments in English language as compared to the total number of executable statements can be counted for single procedures. Procedural Metrics Procedural metric on ABAP token / statement level including declarative statements. Determines the number of statements and maximum nesting depth as well as Cyclomatic Complexity and Halstead coefficients. FANOUT Structural Metrics Structural metric that measures the level of cross linking of different parts of the source code (here: only outgoing links). Comment Language Metrics This metric shows the use of English and German comments in an ABAP source as well as comments in unknown language. It warns of commented-out ABAP and searches for pseudocomments. OO Size Metrics Metric based on the number of ABAP OO elements (methods, interfaces, attributes, and events) in global and local classes.

8. Dynamic Tests
ABAP Unit tests are not static checks; they are calls of special sections of code in the application program. Error messages - such as those triggered by calling methods of the class Cl_AUnit_Assert generally originate in the application code. The list of possible messages comprises: Tolerant Critical Fatal Summary Rfc Call System Timeout

9. User Interfaces

SAP GUI Usability Check Standard Checks Web Dynpro Web Dynpro Programming Conventions Screen Check( Screen Generation and Screen Check for Usability und Accessibility)

10. Search Functions


The category Search Functions contains checks for searching in ABAP source code. Search for tokens (words) The check allows you to search for token patterns consisting of at least three characters in the source code (including comments). A token corresponds to one word in an ABAP record. The scanner symbols '.', ',' and ':' are not part of a token.

Date: 30 Nov 2010

4|P ag e

Purpose of Code Inspector


A comment is seen as a token. The characters '"' and '*' that introduce a comment are part of the token. The following characters have special meanings: + Represents any character * Represents a sequence of any characters Variants that can be controlled with attributes: Searching comments Searching character literals ('...').

Search for statements ABAP Statement Search Function The check allows you to search the source code for several statement patterns. In the pattern, the characters + and * have special meaning: + represents a token (any token) * represents a sequence of tokens (any sequence) The characters + and * also have special meaning in the pattern specification. This only applies if a word contains characters other than + and *. Otherwise the above meaning applies. + represents a single character * represents any sequence of characters Example: READ TABLE * WITH KEY +COMP+ = + This pattern searches for an ABAP statement that contains any sequence of tokens after READ TABLE, followed by WITH KEY. After that, a token is expected that is precisely 6 characters long, begins and ends with any character, and has the character sequence COMP at its centre. At the end of the statement, '=' and any word is expected

11. Application Checks


The category Application Checks contains application-specific checks.

HR Decoupling: Check Infotype Classes Examines whether the programming conventions are observed for the infotype classes for decoupling the business logic. Function module cannot be used Database changes with &1 are not allowed SET/GET &1 is not allowed MESSAGE is not allowed IMPORT/EXPORT is not allowed External call of (routine) in (program)

Date: 30 Nov 2010

5|P ag e

Purpose of Code Inspector

12. Internal Performance Tests


The category 'Internal Performance Tests' contains checks on performance and resource consumption. These checks are performed on special objects that cannot be chosen with the usual code inspector object selection. Checks in this category cannot normally be performed on SAP repository objects and should not therefore be added to check variants.

Analysis of instructions from the SQL trace (performance trace, transaction ST05)

SQL trace check: Analysis of the WHERE condition for SELECT An examination in the SQL trace of WHERE conditions in the SELECT statements. JOINs are not checked. Access to the following buffered tables is checked: SELECT-statement does not contain any WHERE conditions As fully buffered tables can be buffer load processes here, this message is only posted with fully buffered tables if the option 'Suspected buffer loaders also' has been selected. WHERE condition contains only the client field in the SQL trace (possibly generated by the DB interface, or - with CLIENT SPECIFIED - explicitly listed in the ABAP Code) As client-dependent tables that are either fully or generically buffered with one field can be buffer load processes here, this message is only posted for tables of this kind if the option 'Suspected buffer loaders also' has been selected. WHERE condition does not contain any fields of table indexes WHERE condition does not contain any first fields of table indexes In each case, these statements result in a complete database table search (or a search in all entries for a client), as no indexes can be used. The priority of the message depends upon whether the table is buffered. In the case of unbuffered tables, the priority also depends on the size category of the table: Size category 0, 1 => Warning Size category >= 2 => Error

SQL trace check: Analysis of the WHERE conditins for UPDATE and DELETE An analysis is carried out in the SQL trace of the WHERE conditions n the UPDATE and DELETE statements UPDATE dbtab SET ... WHERE DELETE FROM dbtab WHERE ... This analysis searches for the following criteria: UPDATE / DELETE statement without WHERE condition WHERE condition in the SQL trace contains the customer field only (possibly generated from the DB interface or - with CLIENT SPECIFIED explicitly listed in the ABAP Code) WHERE condition does not contain any fields of table indexes WHERE condition does not contain any first fields of table indexes In each case, these statements result in a complete database table search (or a search in all entries for a client), as no indexes can be used. The priority of the message depends on the size category of the table: Size category 0, 1 => Warning Size category >= 2 => Error

Date: 30 Nov 2010

6|P ag e

Purpose of Code Inspector


o
SQL trace check: Accesses to buffered tables SAP table buffering, that is, buffering of database tables on the application server, gives you significantly better performance when making read access when compared to database access You should therefore buffer suitable tables and avoid bypassing the buffer when you have are buffered tables. The following can lead to a bypass: Intentional bypassing with SELECT ... FOR UPDATE and SELECT ... BYPASSING BUFFER The latter cannot be recognized in the SQL trace. Use in JOINs Use in SUBQUERIES Aggregate functions COUNT, MIN, MAX, SUM, AVG SELECT DISTINCT ... GROUP BY ... ORDER BY ... if the sort order does not match the primary key WHERE ... IS [NOT] ZERO No explicit 'SELECT SINGLE' for single record buffering - cannot be recognized in the SQL trace! Key not specified fully for generic or single record buffering 'CLIENT SPECIFIED' on client-specific table without client field in the WHERE condition If the option 'Buffer load accesses etc. also' is selected, every access to internal tables is reported where the reason for bypassing the SAP table buffer cannot be deduced from the SQL trace. Possible reasons for the appearance of this kind of access in the SQL trace might be: Buffer load accesses SELECT SINGLE not used in single-record buffered tables BYPASSING BUFFER used Native SQL used Comparison of two database fields in the WHERE condition (such as SELECT * FROM dbtab AS db WHERE db~field1 > db~field2 )

13. Internal Tests


The category internal checks contain local tests.

Test of CL_ABAP_COMPILER Recognizing Dead Code Empty Test Check for Enhance ability of Tables

14. Proxy Checks


There are different checks of proxy objects, which can be separated in two groups: 1. the checks, which check the proxy objects regarding the Enterprise Services Repository. 2. the checks, which check the proxy objects in the Back End(e.g. proxy metadata, etc.).

Date: 30 Nov 2010

7|P ag e

Potrebbero piacerti anche