ABAP Keyword Documentation → ABAP − Reference → Program Flow Logic → Expressions and Functions for Conditions → log_exp - Logical Expressions → rel_exp - Predicates → rel_exp - Predicate Expressions
rel_exp - IS BOUND
Other versions: 7.31 | 7.40 | 7.54
Syntax
... ref IS [NOT] BOUND ...
Effect
This predicate expression checks whether a reference variable contains a valid reference. A
reference variable must be specified for ref
. This is a
functional operand position.
- A data reference is valid if it can be dereferenced.
- An object reference is valid if it points to an object.
When using the addition NOT
, the expression is true if the reference variable does not contain a valid reference. In this case the reference variable is either initial and contains the
null reference, or it is not initial and contains an invalid reference that does not point to an object.
Note
A non-initial reference variable that contains a heap reference is generally always valid (since it keeps an object alive). Only heap references that point to rows from internal tables can become invalid when rows are deleted. A data reference variable that contains a stack reference, on the other hand, can become invalid if the referenced data object is removed from the stack.
Example
The logical expression in the IF
statement is false. The data reference dref
contains a reference to a deleted table row.
itab TYPE TABLE OF ...
FIELD-SYMBOLS <fs> TYPE ANY.
dref = REF #( itab[ ... ] ).
...
CLEAR itab.
...
IF dref IS BOUND.
ASSIGN dref->* TO <fs>.
ENDIF.
Executable Example
Predicate Expression IS NOT BOUND