ABAP

ABAP Metrics

Andthen Operators

  • Mnemonic ANTH

  • Description Number of 'andthen' operators

Number of comment blocks

  • Mnemonic BCOM

  • Description Number of comment blocks.

Header Blocks Of Comment

  • Mnemonic BHCO

  • Description Number block of comment placed before the beginning of the artefact.

Blank Lines

  • Mnemonic BLAN

  • Description Number of blank lines of code in the source file(s).

Brace Lines

  • Mnemonic BRAC

  • Description Number of lines of code containing only a brace in the source file(s).

Case Blocks

  • Mnemonic CABL

  • Description Number of 'case' blocks in 'switch' in the function

Case Labels

  • Mnemonic CASE

  • Description Number of 'case' labels in the function

Catch Statements

  • Mnemonic CATC

  • Description Number of 'catch' statements in the function

Cyclomatic Complexity

  • Mnemonic CCN

  • Description Number of linearly independent paths in the function control graph.

Control Flow Token

  • Mnemonic CFT

  • Description Number of tokens in the control flow of functions

Call Graph Depth

  • Mnemonic CGDM

  • Description Maximum depth of the call graph.

Number of Check instruction

  • Mnemonic CHECK

  • Description Number of Check instruction

Comment Lines

  • Mnemonic CLOC

  • Description Number of lines of comments in the source file(s).

Continue Statements

  • Mnemonic CONT

  • Description Number of 'continue' statements in the function

Public Constant

  • Mnemonic CPBL

  • Description Public Constant

Protected Constant

  • Mnemonic CPRT

  • Description Protected Constant

Private Constant

  • Mnemonic CPRV

  • Description Private Constant

Commented Statements

  • Mnemonic CSTAT

  • Description Number of Commented Statements.

Minimum Number of Cycles

  • Mnemonic CYCL

  • Description Minimum number of call graph cycles in which the function is involved (including recursivity).

Default Statement

  • Mnemonic DEFT

  • Description Number of 'default' blocks in 'switch' in the function

Distinct Operands

  • Mnemonic DOPD

  • Description Number of distinct operands: variables and constants ([Halstead,76]: n2)

Distinct Operators

  • Mnemonic DOPT

  • Description Number of distinct operators: language keywords ([Halstead,76]: n1)

Public Data

  • Mnemonic DPBL

  • Description Public Data

Protected Data

  • Mnemonic DPRT

  • Description Protected Data

Private Data

  • Mnemonic DPRV

  • Description Private Data

Else Statements

  • Mnemonic ELSE

  • Description Number of 'else' statements

Call to exit

  • Mnemonic EXIT

  • Description Number of calls to the exit function

For Statements

  • Mnemonic FOR

  • Description Number of 'for' statements in the function

File Type Count

  • Mnemonic FTYP

  • Description File Type Count

Structures Added

  • Mnemonic SADD

  • Description Number of control structures added since the previous version.

Structures Modified

  • Mnemonic SMOD

  • Description Number of control structures modified since the previous version.

Structures Removed

  • Mnemonic SREM

  • Description Number of control structures removed since the previous version.

Number of Structures

  • Mnemonic SSIZ

  • Description Number of control structures: iterations, selections, sequences

Header Lines Of Comment

  • Mnemonic HCOM

  • Description Number of comment lines placed before the beginning of the artefact.

Header Lines Of Code

  • Mnemonic HLOC

  • Description Number of lines between the function or class definition and the first opening brace.

Cloned Code

  • Mnemonic ICC

  • Description Duplicated code in this artefact

Cloned Control Flow Tokens

  • Mnemonic ICFTC

  • Description Number of duplicated tokens in control flow of functions

If Statements

  • Mnemonic IF

  • Description Number of 'if' statements

Line Count

  • Mnemonic LC

  • Description Number of lines.

Loop Statements

  • Mnemonic LOOP

  • Description Number of loop statements in the function

Mixed Lines

  • Mnemonic MLOC

  • Description Number of lines containing both code and comment in the source files.

Maximum Nested Structures

  • Mnemonic NEST

  • Description Maximum number of nested structures

Non-Cyclic Paths

  • Mnemonic PATH

  • Description Number of non-cyclic paths in the function.

Orelse operators

  • Mnemonic OREL

  • Description Number of 'orelse' operators

Return Statements

  • Mnemonic RETURN

  • Description Number of 'return' statements in the function

Repeated Code Blocks

  • Mnemonic RS

  • Description Duplicated blocks in the function

Skipped Lines of Comment code

  • Mnemonic SKLC

  • Description Skipped Lines of Comment code i.e. lines that match a user defined regular expression to skip lines of comments.

Source Lines Of Code

  • Mnemonic SLOC

  • Description Number of lines of source code in the source file(s).

Executable Statements

  • Mnemonic STAT

  • Description Total number of executable statements.

Switch Statements

  • Mnemonic SWIT

  • Description Number of 'switch' statements in the function

Throw Statements

  • Mnemonic THRO

  • Description Number of 'throw' statements in the function

Operand Occurrences

  • Mnemonic TOPD

  • Description Number of occurrences of operands: variables and constants ([Halstead,76]: N2)

Operator Occurrences

  • Mnemonic TOPT

  • Description Number of occurrences of operators: language keywords ([Halstead,76]: N1)

Try Statements

  • Mnemonic TRY

  • Description Number of 'try' statements in the function

Lines Added

  • Mnemonic LADD

  • Description Number of lines added since the previous version.

Lines Modified

  • Mnemonic LMOD

  • Description Number of lines modified since the previous version.

Lines Removed

  • Mnemonic LREM

  • Description Number of lines removed since the previous version.

While Statements

  • Mnemonic WHIL

  • Description Number of 'while' statements in the function

ABAP Ruleset

Avoid using APPEND statements in loops

  • Mnemonic AVOIDAPPENDINLOOP

  • Description Avoid using COMMIT WORK statements in loops.

Avoid using APPEND in SQL SELECT statements

  • Mnemonic AVOIDAPPENDINSELECT

  • Description Avoid using APPEND in SQL SELECT statements.

Avoid using BREAK-POINT

  • Mnemonic AVOIDBREAKPOINT

  • Description Avoid using BREAK-POINT

Avoid using CHECK in SQL SELECT statements

  • Mnemonic AVOIDCHECKINSELECT

  • Description Avoid using CHECK in SQL SELECT statements

Avoid using COMMIT WORK statements in loops

  • Mnemonic AVOIDCOMMITWORKINLOOP

  • Description Avoid using COMMIT WORK statements in loops.

Avoid obsolete DATA BEGIN OF OCCURS statement

  • Mnemonic AVOIDDATAOCCURS

  • Description Avoid obsolete DATA BEGIN OF OCCURS statement

Avoid using INSERT statements in loops

  • Mnemonic AVOIDINSERTINLOOP

  • Description Avoid using INSERT statements in loops. Querying in a loop can lead to performance issues.

Avoid using INSERT in SQL SELECT statements

  • Mnemonic AVOIDINSERTINSELECT

  • Description Avoid using INSERT in SQL SELECT statements

Avoid using SQL INTO statements in loops

  • Mnemonic AVOIDINTOINLOOP

  • Description Avoid using SQL INTO statements in loops.

Avoid using SELECT *

  • Mnemonic AVOIDSELECTALL

  • Description SELECT * should be avoided as it does not enable to keep control on the flow return and could therefore be error prone and potentially lead to performance issues.

Avoid using the SQL "BYPASSING BUFFER" clause

  • Mnemonic AVOIDSELECTBYPASS

  • Description The BYPASSING BUFFER clause causes the SELECT statement to avoid the SAP buffering and to read directly from the database and not from the buffer on the application server.

Avoid using SELECT DISTINCT Statement

  • Mnemonic AVOIDSELECTDISTINCT

  • Description The SQL DISTINCT clause causes the SELECT statement to avoid the SAP buffering and to read directly from the database and not from the buffer on the application server.

Avoid SELECT SQL statement without a WHERE clause

  • Mnemonic AVOIDSELECTNOWHERE

  • Description Avoid SELECT SQL statement without a WHERE clause

Avoid SELECT SQL statement with a WHERE clause containing the NOT EQUAL operator

  • Mnemonic AVOIDSELECTWHERENOTEQ

  • Description Avoid SELECT SQL statement with a WHERE clause containing the NOT EQUAL operator.

Avoid using SQL Aggregate Functions

  • Mnemonic AVOIDSQLAGGREGATEFUNC

  • Description SQL COUNT(..) , MIN(..), MAX(..), SUM(..), AVG(..) functions cause the SAP table buffer to be bypassed and so usage of such functions can lead to some performance issues.

Avoid using SUBMIT statements in loops

  • Mnemonic AVOIDSUBMITINLOOP

  • Description Avoid using SUBMIT statements in loops.

Avoid using UPDATE, MODIFY, DELETE statements in loops

  • Mnemonic AVOIDUPDELINLOOP

  • Description Avoid using UPDATE, MODIFY, DELETE statements in loops. Querying in a loop can lead to performance issues.

Avoid UPDATE or DELETE SQL Statement without a WHERE clause

  • Mnemonic AVOIDUPDELNOWHERE

  • Description Avoid UPDATE or DELETE SQL Statement without a WHERE clause

Avoid using GROUP BY in queries

  • Mnemonic AVOIDUSINGSQLGROUPBY

  • Description Using GROUP BY in SQL queries can lead to performance issues.

Avoid using the JOIN SQL clause

  • Mnemonic AVOIDUSINGSQLJOIN

  • Description Using the SQL JOIN clause leads to bypass the SAP table buffer.

Avoid using LIKE in SQL queries

  • Mnemonic AVOIDUSINGSQLLIKE

  • Description Using LIKE in SQL queries can lead to performance issues.

Avoid using the WAIT statement

  • Mnemonic AVOIDWAIT

  • Description Avoid using the WAIT statement.

The class name should conform to the defined standard

  • Mnemonic CLASSNAMINGCONVENTION

  • Description The class name should conform to the defined standard

Commented-out Source Code is not allowed

  • Mnemonic R_CSTAT

  • Description Commented-out Source Code is not allowed

Missing Default

  • Mnemonic DEFAULT

  • Description The final clause of a switch statement shall be the default clause (see [MISRA-C:2004]: RULE 15.3).

Missing final else

  • Mnemonic ELSEFINAL

  • Description All if ... else if constructs shall be terminated with an else clause (see [MISRA-C:2004]: RULE 14.10).

Forbid call to a system function

  • Mnemonic FORBIDCALLCFUNC

  • Description Call of a System Function: CALL 'cfunc' is only intended for internal usage. Incompatible changes and further development is possible at any time and without warning or notice.

Forbid calls to dialog transactions

  • Mnemonic FORBIDCALLDIALTRANS

  • Description Forbid calls to dialog transactions.

Forbid use of GENERATE REPORT / SUBROUTINE POOL / DYNPRO

  • Mnemonic FORBIDGENERATEPROG

  • Description This statement is exclusively for internal use within SAP Technology Development. Incompatible changes or developments are possible at any time without prior warning or notes.

Forbid calls to GET RUN TIME.

  • Mnemonic FORBIDGETRUNTIME

  • Description Forbid calls to GET RUN TIME.

Forbid use of INSERT/DELETE REPORT/TEXTPOOL

  • Mnemonic FORBIDINSERTPROG

  • Description This statement is exclusively for internal use within SAP Technology Development. Incompatible changes or developments are possible at any time without prior warning or notice.

Forbid uses of OFFSET in ASSIGN

  • Mnemonic FORBIDOFFSETINASSIGN

  • Description Forbid uses of OFFSET in ASSIGN.

Forbid use of SYSTEM-CALL

  • Mnemonic FORBIDSYSTEMCALL

  • Description This statement is only for !Internal use in SAP Basis development!. Its use is subject to various restrictions, not all of which may be listed in the documentation. Changes and further development, which may be incompatible, may occur at any time, without warning or notice!

The form name should conform to the defined standard

  • Mnemonic FORMNAMINGCONVENTION

  • Description The form name should conform to the defined standard

The function name should conform to the defined standard

  • Mnemonic FUNCTIONNAMINGCONVENTION

  • Description The function name should conform to the defined standard

Avoid calling a function module without handling exceptions

  • Mnemonic HANDLEERRORCALLFUNC

  • Description Handling the exceptions when calling a function module is optional but should be mandatory to correctly handle errors in production.

The macro name should conform to the defined standard

  • Mnemonic MACRONAMINGCONVENTION

  • Description The macro name should conform to the defined standard

The method name should conform to the defined standard

  • Mnemonic METHODNAMINGCONVENTION

  • Description The method name should conform to the defined standard

Factorizable Classes

  • Mnemonic CAC_CL

  • Description Consider classes refactorization

Factorizable Files

  • Mnemonic CAC_FI

  • Description Consider files refactorization

Factorizable Functions

  • Mnemonic CAC_FN

  • Description Consider functions refactorization

Factorizable Packages

  • Mnemonic CAC_PKG

  • Description Consider packages refactorization

Cloned Classes

  • Mnemonic CC_CL

  • Description There shall be no duplicated classes

Cloned Files

  • Mnemonic CC_FI

  • Description There shall be no duplicated files

Cloned Functions

  • Mnemonic CC_FN

  • Description There shall be no duplicated functions

Cloned Algorithmic

  • Mnemonic CFTC_FN

  • Description There shall be no algorithmic cloning

Continue shall not be used

  • Mnemonic NOCONT

  • Description The 'continue' statement shall not be used (see [MISRA-C:2004]: RULE 14.5).

FIXME shall not be commited in sources code

  • Mnemonic R_NOFIXME

  • Description FIXME shall not be commited in sources code as it brings confusion regarding code reliability.

Do not use "Native SQL" instructions

  • Mnemonic NONATIVESQL

  • Description Native SQL should not be used.

Avoid Duplicated Blocks in Function

  • Mnemonic RS_FN

  • Description There shall be no duplicated parts in functions

TODO shall not be commited in sources code

  • Mnemonic R_NOTODO

  • Description TODO shall not be commited in sources code as it brings confusion regarding code reliability.

Missing case in switch

  • Mnemonic ONECASE

  • Description Every switch statement shall have at least one case clause (see [MISRA-C:2004]: RULE 15.5).

Prevent use of EDITOR-CALLS

  • Mnemonic PREVENTEDITORCALL

  • Description This statement bypasses the authority checks that are performed when calling the ABAP editor via transaction code.

The program or report name should conform to the defined standard

  • Mnemonic PROGREPORTNAMINGCONVENTION

  • Description The program or report name should conform to the defined standard

Relaxed violation

  • Mnemonic RELAX

  • Description A rule violation is relaxed and justified.

Multiple exits are not allowed

  • Mnemonic RETURN

  • Description A function shall have a single point of exit at the end (see [MISRA-C:2004]: RULE 14.7).