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 - sql_string 

SQL Expressions, Chainings

This example demonstrates how strings are chained .in SQL expressions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    SELECT FROM spfli
           FIELDS concat( concat( carrid,'_' ), connid ) AS key,
                  'from' && ' ' && cityfrom &&
                  ' to' && ' ' && cityto AS connection
           INTO TABLE @DATA(results).

    cl_demo_output=>display( results ).

Description

In a SELECT list, two columns of a results set of a query are created using chainings of strings.

  • The first column key cannot be created using the operator &&. The column CONNID does not have the required data type and cast expressions cannot be used either. The built-in function CONCAT is used instead.
  • The second column connection can be constructed from columns and literals using the operator &&.