SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Open SQL → Open SQL - Reads → SELECT clauses →
SELECT - WHERE
Syntax
... WHERE sql_cond ...
Effect
The addition WHERE restricts the number of rows included in the results set by the statement SELECT of a query, by using a logical expression sql_cond. A row is only included in the results set if the logical expression is true.
Except for columns of type STRING or RAWSTRING plus LCHR, LRAW, all columns of the data sources specified after FROM can be evaluated in the WHERE condition of a query. The columns do not necessarily have to be a part of the results set.
The client column of a client-specific data source can only be used in the WHERE condition if automatic client handling is switched off using the addition CLIENT SPECIFIED. This is checked in full in the strict modes of the syntax check from Release 7.40, SP05.
Notes
Example
Reads all objects in the ABAP keyword documentation from the table DOKIL using a suitable WHERE condition. Messages of the code inspector are suppressed using pseudo comments due to the table buffering bypass.
SELECT FROM dokil
FIELDS object, langu
WHERE id = 'SD' AND
typ = 'E' AND
( object LIKE 'ABAP%' OR
object LIKE 'ABEN%' OR
object LIKE 'DYNP%' ) AND
( langu = 'D' OR langu = 'E' ) "#EC CI_GENBUFF
ORDER BY object, langu
"#EC CI_BYPASS
INTO TABLE @DATA(dokil_tab).
Executable Examples