Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Operands and Expressions 

ABAP SQL - SQL Expressions sql_exp

Other versions: 7.31 | 7.40 | 7.54


... sql_elem 
  | sql_func
  | sql_arith
  | sql_cast
  | sql_string
  | sql_case
  | sql_agg
  | sql_win...


SQL expressions are expressions that can be specified in the following positions of ABAP SQL statements:

SQL expressions are passed to the database system, executed there, and the result is passed to the AS ABAP if requested.

In general, the operands of SQL expressions can also be SQL expressions, the result of which must have a suitable data type. There are restrictions to individual operand positions, which are described for these.

The following SQL expressions exist:

Every expression can be enclosed in parentheses. The result of an expression is used in the ABAP SQL statement in accordance with the operand position, with the data type in nested expressions being specified by the outermost expression.



Syntax example for specifying SQL expressions in different operand positions in a SELECT statement

SELECT FROM sflight 
       FIELDS CONCAT( carrid, connid ) AS key, 
              MAX( seatsmax - seatsocc ) AS max_free, 
              MIN( seatsmax - seatsocc ) AS min_free 
        GROUP BY carrid, connid 
        HAVING SUM( seatsmax - seatsocc ) > 100 
        ORDER BY key 
        INTO TABLE @DATA(itab).

This translation does not reflect the current version of the documentation.


sql_exp - sql_elem

sql_exp - sql_func

sql_exp - sql_arith

sql_exp - sql_cast

sql_exp - sql_string

sql_exp - sql_case

sql_exp - sql_agg

sql_exp - sql_win

sql_exp - ( )