Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Read Accesses →  SELECT →  SELECT - result →  SELECT - select_list →  SELECT - col_spec →  SELECT - sql_exp 

sql_exp - sql_coalesce

Other versions: 7.31 | 7.40 | 7.54


... coalesce( arg1, arg2 ) ...


The coalesce function in Open SQL returns the value of the argument arg1 (if this is not the null value); otherwise it returns the value of the argument arg2. A blank must be placed after the opening parenthesis and before the closing parenthesis. A comma must be placed between the arguments. There are a number of possible arguments:

  • Columns and other expressions of dictionary types, except for ACCP, DF16_SCL (obsolete), DF34_SCL (obsolete), LCHR, LRAW, PREC, RAWSTRING, SSTRING, and STRING
  • Host variables and literals of ABAP types, except for string and xstring

The data types of both arguments must either match of the data type of one argument must represent the full value of the other data type. The result has the dictionary type of the argument with the greater value range.


The coalesce function can be used to assign a target object a self-defined value or the result of an expression when a null value is read. The type-appropriate initial value is assigned by default.