ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Open SQL → Open SQL - Read Accesses → SELECT → SELECT - result → SELECT - select_list → SELECT - col_spec → SELECT - sql_exp → Examples of SQL Expressions
SQL Expressions, Constant in SELECT List
This example demonstrates one way to use a constant value in the SELECT
list.
Other versions:
7.31 | 7.40 | 7.54
Source Code
DATA carrier TYPE scarr-carrid.
cl_demo_input=>request( CHANGING field = carrier ).
SELECT SINGLE @abap_true
FROM scarr
WHERE carrid = @carrier
INTO @DATA(exists).
IF exists = abap_true.
cl_demo_output=>display(
|Carrier { carrier } exists in SCARR| ).
ELSE.
cl_demo_output=>display(
|Carrier { carrier } does not exist in SCARR| ).
ENDIF.
Description
Determines whether a row exists for a WHERE
condition (regardless of the
content of the row). A constant is specified to make it unnecessary to specify a column of the database and transport it. The target object exists
is created using an inline declaration.