ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Operands and Expressions → ABAP SQL - SQL Conditions sql_cond → sql_cond - rel_exp for Statements
sql_cond - IS INITIAL
Other versions:
7.31 | 7.40 | 7.54
Syntax
... operand IS [NOT] INITIAL ...
Effect
This relational expression is true if the value of the operand operand
is (is not) the
initial value of its built-in dictionary type.
The following applies for operand
:
- SQL expressions except for aggregate expressions and window expressions can be specified.
- In a
HAVING
clause, aggregate expressions can also be used.
Notes
-
The expression
IS [NOT] INITIAL
is 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. This is of particular use in dynamic conditions. -
The expression
IS [NOT] INITIAL
must not be confused with the expressionIS [NOT] NULL
. -
If used, the relational expression
IS [NOT] INITIAL
forces strict mode from Release 7.53.
Example
Reads the rows of the database table DEMO_DDIC_TYPES in which a dynamically specified column contains their type-dependent initial value.
DATA column TYPE string VALUE `INT8`.
cl_demo_input=>request( CHANGING field = column ).
column = to_upper( column ).
DATA(components) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( 'DEMO_DDIC_TYPES' )
)->components.
IF NOT line_exists( components[ name = column ] ).
cl_demo_output=>display( `Invalid request` ).
RETURN.
ENDIF.
DATA(cond) = column && ` IS INITIAL`.
TRY.
SELECT *
FROM demo_ddic_types
WHERE (cond)
INTO TABLE @DATA(result).
CATCH cx_sy_dynamic_osql_semantics INTO DATA(xref).
cl_demo_output=>display( xref->get_text( ) ).
ENDTRY.