SELECT - cond
... [FOR ALL ENTRIES IN itab] WHERE sql_cond ... .
WHERE restricts the number of lines included in the result set
by the statement
SELECT, by using a logical expression
sql_cond. The logical expression compares the content of columns in the
database with the content of ABAP data objects, or with the content of other columns. You can use the
FOR ALL ENTRIES
to compare the content of a column in the database with a component with all lines of a structured internal table
The logical expression
sql_cond is either true, false, or unknown. The expression is unknown if one of the columns involved in the database contains a
null value and is evaluated
with another comparison as
IS NULL. A line is only included in the resulting set if the logical expression is true.
Except for columns of type STRING or RAWSTRING, all columns of the database tables or
views listed after
FROM can be evaluated after the
WHERE condition. The columns do not necessarily have to be a part of the resulting set.
The client identifier cannot be queried in the
WHEREcondition, if automatic client handling is not deactivated using the addition
WHEREcondition of the
SELECTstatement described here includes the
WHEREconditions of the Open SQL statements
OPEN CURSOR, and
The logical expressions of the
WHEREcondition can also all be used after the addition
HAVING, and sometimes in the
ONcondition of a Join expression after the addition
If the database table is accessed with generic
SAP buffering, the buffered area must be fully specified in the
WHEREcondition, otherwise buffering is ignored.
If the database tables are accessed using single record buffering, the conditions joined using
WHEREcondition must be listed for all key fields of the primary key, otherwise buffering is ignored.