ABAP Data Declaration Inline Data Declaration in SELECT Statement


Example

When using an inline data declaration inside of a SELECT...ENDSELECT block or SELECT SINGLE statement, the @ character must be used as an escape character for the DATA(lv_cityto) expression. Once the escape character has been used, all further host variables must also be escaped (as is the case with lv_carrid below).

DATA lv_carrid TYPE s_carr_id VALUE 'LH'.
SELECT SINGLE cityto FROM spfli
       INTO @DATA(lv_cityto)
       WHERE carrid = @lv_carrid
       AND   connid = 2402.
WRITE: / lv_cityto.

Outputs BERLIN.