Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Reads →  SELECT clauses →  SELECT - WHERE 

SQL Expressions in the WHERE Condition

This example demonstrates how SQL expressions are used on the left side of a WHERE condition.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    SELECT carrid, connid, fldate, seatsmax, seatsocc,
           seatsmax - seatsocc AS seatsfree
           FROM sflight
           WHERE seatsmax - seatsocc > @( input( ) )
           INTO TABLE @DATA(result).
    cl_demo_output=>display( result ).

Description

On the left side of the relational expression, the content of two specified columns is subtracted in an SQL expression. This calculation is performed on the database. The right side is a functional method call in a host expression.