Monday, October 31, 2016


Assertion in software development is technique used to detect and track a state in program which should not occur. In computer programming it is so called programming predicate that developer assumes that is always true. The predicate is Boolean valued function which returns a true–false expression.

Information about the predicate can be placed into comment of the program code. However it can be also directly included in the code. While the code is compiled or the compiled program runs there are checks for these predicates. These do not serve as treatment of unexpected or err nous states like user input checks. Instead it is about the detection of the status which is not supposed to happen.

Assertion or so called checkpoints define points in a program, at which the state of the program can be tested during program execution. Checkpoints are either conditional or unconditional. Conditional checkpoints are defined by ASSERT, unconditional checkpoints by BREAK-POINT or LOG-POINT. Needless to say that the checkpoint of all types are non-operational statement used just for test purposes.

Activation/deactivation of checkpoints outside of the program can be done by assigning them to a checkpoint group in t-code SAAB.

How the checkpoints or assertion is supported in ABAP programming language? There are a couple of ABAP statements for this purpose.

ASSERT statement - it is a checkpoint. It is used to verify specific assumptions about the status of a program at a specific point. The ASSERT statement is instantly recognizable for example when analysing ABAP dump.

LOG-POINT statement - is a checkpoint which creates a log entry when an active logpoint is reached. The logpoint must be assigned to a checkpoint group. The statement LOG-POINT was introduces to replace wrong usage of the ASSERT with a condition that is always wrong for simply writing log entries.

BREAK-POINT statement - is placed in the ABAP program. When it is reached in foreground/dialog processing it branches to the ABAP Debugger. If the breakpoint is set by user in ABAP editor it has limited validity - until user logs off. In case the breakpoint is hard-coded with the statement BREAK-POINT it is considered as unconditional checkpoint with an unlimited validity which is either always active or activated by assigning it to a checkpoint group.

More information:

See example of LOG-POINT statement usage:
Below see a simple log entry created by LOG-POINT statement.

No comments: