SAP CDS NULL VALUES



Get Example source ABAP code based on a different SAP table
  



ABAP_CDS - Null Values
A null value is a special value returned by a database in order to indicate an undefined value or result.
In ABAP CDS, null values can be handled using one of the following:
The condition IS NULL.
The addition ELSE NULL in a case distinction in a CDS view entity.
The function COALESCE.
The parameter on_null in date and time conversion functions .
In the SELECT statement of a CDS view entity, null values can be produced by
aggregate functions,
in outer joins,
in CDS expressions.
The topic ABAP SQL - Null Values explains the handling of null values in ABAP SQL.

ABAP_EXAMPLE_VX5
In the following example, the field NullResult contains a null value because the CASE expression on the left side does not find a true WHEN condition. It evaluates the ELSE branch, and sets the result to null accordingly.
DDLS DEMO_CDS_NULL
The following SELECT statement evaluates the CDS view entity using the ABAP SQL coalesce function. Since the case expression returns a null value, the coalesce function returns 'Null' as result.
ABEXA 01755
ABAP_EXAMPLE_END