ABAP - Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Read Accesses →  SELECT → 

SELECT - WHERE

Quick Reference

Syntax

... [FOR ALL ENTRIES IN itab] WHERE sql_cond ...

Effect

The addition WHERE restricts the number of rows included in the results 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 host variables, literals, or with the content of other columns. The optional addition FOR ALL ENTRIES can be used to compare the content of a column in the database with a component with all rows of a structured internal table itab.

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 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 after the WHERE condition. The columns do not necessarily have to be a part of the results set.

Notes



Continue
WHERE - sql_cond
WHERE - FOR ALL ENTRIES