SAP WHERE ABAP Statements
Get Example source ABAP code based on a different SAP table
• WHERE SELECT
SELECT>, WHERE> Short Reference >
ABAP_SYNTAX
... WHERE sql_cond> ...>
What does it do?
The addition WHERE> restricts the number of rows that are included in the result set by the statement SELECT> of a query> by using a logical expression sql_cond>>. A row is only included in the result set if the logical expression is true.
Except for columns of type STRING>, RAWSTRING>, or GEOM_EWKB>, or LCHR> and LRAW>, all columns of the data sources> specified after FROM>> can usually be evaluated in the WHERE> condition of a query>. Special rules apply to some logical expressions. The columns do not necessarily have to be a part of the result set.
Implicit AB_SQL client handling> applies to the WHERE> clause. The client column> of a client-dependent data source cannot be used as an operand in the WHERE> condition.
Latest notes:
If the data source is accessed using generic table buffering>, the buffered area must be specified completely in the WHERE> condition, otherwise buffering is bypassed.
If the data sources are accessed using single record buffering, the conditions combined using AND> in the WHERE> condition must be specified for all key fields of the primary key, otherwise buffering is bypassed.
For frequently used SELECT> statements with an identical WHERE > condition, it can be useful to create an index>. In WHERE> conditions, the fields of the index should be expressed as equality comparisons and combined using the AND> operator. All the fields of an index that are behind a field, for which a comparison other than => or EQ> is specified in the WHERE> clause, cannot be used for searching in the index.
It is currently not possible to use aggregate expressions> as operands in a WHERE> condition. This is only possible in the HAVING>> clause.
If one of the columns involved in the logical expression sql_cond>> contains the null value>, its result is unknown, and no row is included in the result set.
NON_V5_HINTS
The client column> of a client-dependent data source can still be used in the ON> condition if implicit client handling> is disabled using the obsolete addition CLIENT SPECIFIED >>.
ABAP_HINT_END
ABAP_EXAMPLE_VX5
Reading of 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.
ABEXA 00764
ABAP_EXAMPLE_END
ABAP_EXAMPLES_ABEXA
Host Expressions in the WHERE > Condition>
SQL Expressions in the WHERE > Condition>
ABAP_EXAMPLE_END
Return to menu