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 

sql_exp - ( )

Other versions: 7.31 | 7.40 | 7.54


... ( sql_exp ) ...

Every full SQL expression sql_exp can be enclosed in parentheses ( ... ). There must be a blank after the opening parenthesis and before the closing parenthesis. Parenthesis specify the priority with which expressions are evaluated. Parenthesis levels are evaluated from inside out and from left to right. The result of a parenthesis is the result of the outermost expression in the parenthesis.


  • Using parentheses always means specifying an SQL expression. Parentheses can only be used for operand positions for which SQL expressions are possible. This particularly applies to placing parentheses around elementary SQL expressions. Without parentheses, they can also be used in specific operand positions in which no SQL expressions are possible.


Parenthesizes a subtraction as the dividend in a division.

SELECT FROM sflight 
       FIELDS carrid, 
      ( CAST( seatsmax AS FLTP ) -  CAST( seatsocc AS FLTP ) ) 
       / CAST( seatsmax AS FLTP ) AS availability 
       ORDER BY carrid, connid, fldate 
       INTO TABLE @DATA(result). 

cl_demo_output=>display( result ).