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 INITIAL
Other versions: 7.31 | 7.40 | 7.54
Syntax
... operand IS [NOT] INITIAL ...
Effect
This predicate expression checks whether the operand operand is initial. The expression is true, if the operand contains its type-dependent
initial value. Any data objects can be specified for operand. This is an
extended functional operand position in which, alongside
functional method calls,
constructor expressions, or
table expressions, certain built-in functions can also be specified.
If the addition NOT is specified, the expression is true if the operand contains a value other than its type-dependent initial value
Notes
- The expression
IS [NOT] INITIALis suitable for checking the type-dependent initial value (regardless of its actual data type), instead of comparing it with a type-friendly operand that contains the initial value.
- If a functional method call is specified as
operand, a potential short form of the following:
... operand IS NOT INITIAL ...
- It is possible, but not recommended, to always specify built-in functions or expressions as
operand, for example:
- It is better to use
str IS INITIALoritab IS INITIALinstead ofstrlen( str ) IS INITIALorlines( itab ) IS INITIAL.
- It is better to use the predicate function
matchesinstead of match( ... ) IS INITIAL.
- It is better to use the arguments of the constructor expression instead of
VALUE type( ... ) IS INITIAL.
- An enumerated object can be specified for
operand. A check is made on the initial value in accordance with its base type.
- Calculation expressions cannot be specified for
operand.
Example
The logical expression in the IF statement is true if the internal table in the SELECT statement was filled with rows.
...
CLEAR spfli_tab.
SELECT *
FROM spfli
WHERE ...
INTO TABLE @spfli_tab.
IF spfli_tab IS NOT INITIAL.
...
ENDIF.