Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Operands and Expressions →  ABAP SQL - SQL Operands sql_elem →  ABAP SQL - @( expr ) 

Host Expressions, Use in the WHERE Condition

This example demonstrates host expressions on the right side of a relational expression of a WHERE condition.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA name TYPE scarr-carrname VALUE 'United Airlines'.
    cl_demo_input=>request( CHANGING field = name ).

    SELECT carrid, connid, cityfrom, cityto
           FROM spfli
           WHERE carrid =
             @( VALUE spfli-carrid( carriers[ KEY name
                                             carrname = name ]-carrid
                                             OPTIONAL ) )
           INTO TABLE @DATA(result).

    cl_demo_output=>display( result ).

Description

A table expression is evaluated as a host expression on the right side of an SQL condition. The result is used for the comparison with the column specified on the left side.