Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Overview 

ABAP SQL - Null Values

A null value is an initial value of an empty column in the row of a database table. Null values do not correspond to any content of data objects in ABAP.

In ABAP SQL, null values can be handled using the condition IS NULL, a null indicator, and the function coalesce. Write ABAP SQL statements generally do not create null values, except when editing views that do not cover all columns of a database column.

Depending on the database system, empty strings can also be displayed as null values. Null values can still arise in database tables if the new columns are appended to filled tables.

In reads using the ABAP SQL statement SELECT, null values can be produced by aggregate functions, in outer joins in SQL expressions, and when CDS views containing appropriate constructs are accessed. When transferred to data objects, they are transformed to type-dependent initial values. However, in the additions GROUP BY and ORDER BY, in table buffering, and when using internal tables as data sources, null values are treated as such. A null indicator of a structured target area of a query can show which columns of the results set contain null values and which do not.

Other versions: 7.31 | 7.40 | 7.54


  • When subqueries are inserted using INSERT or MODIFY, any null values are also transformed to type-dependent initial values or raise an exception after an attempt to set a key field to the null value.

  • In Native SQL and AMDP, null values passed to ABAP objects are also transformed to their type-dependent initial values.

  • It is, by principle, not possible to insert null values in key fields of database tables. If attempted, this raises an exception on the database.

  • In ABAP Dictionary, a flag for initial values can be set when inserting new columns in existing database tables to preserve the type-dependent initial value instead of the null value.


In the following example, the condition IS NULL is true because the CASE expression on the left side does not find a true WHEN condition and does not have an ELSE branch.

DELETE FROM demo_expressions. 
INSERT demo_expressions FROM @( VALUE #( id = 'X' ) ). 

       FROM demo_expressions 
       INTO @DATA(wa).