Ansicht
Dokumentation

ABENCDS_COALESCE_EXPRESSION_V1 - CDS COALESCE EXPRESSION V1

ABENCDS_COALESCE_EXPRESSION_V1 - CDS COALESCE EXPRESSION V1

RFUMSV00 - Advance Return for Tax on Sales/Purchases   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, coalesce

... COALESCE( arg1, arg2 ) ...

Effect

Coalesce function in a SELECT statement of a . Can be used to check whether arg1 contains a null value. In ABAP CDS, the coalesce function has two mandatory positional parameters, arg1 and arg2. It checks whether arg1 contains a null value. If yes, then it returns the value of arg2. If no, then it returns the value of arg1. If both arg1 and arg2 are null, then the null value is returned.

The valid argument types for arg1 and arg2 are all dictionary types except ACCP, DF16_SCL (obsolete), DF34_SCL (obsolete), DF16_DEC, DF34_DEC, DF16_RAW, DF34_RAW, LCHR, LRAW, PREC, RAWSTRING, STRING, and GEOM_EWKB.

The data types of both arguments must either be the same or the data type of one argument must represent the value of the other data type. The result has the dictionary type of the argument with the largest value range.

Note

A coalesce function is a short form of the following complex case distinction:

CASE WHEN arg1 IS NOT NULL THEN arg1
     ELSE arg2
END

Example

The following DDIC-based CDS view demonstrates the syntax of the coalesce function.






TXBHW - Original Tax Base Amount in Local Currency   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 2770 Date: 20240424 Time: 094540     sap01-206 ( 41 ms )