SAP WHERE LOGEXP SUBQUERY

Get Example source ABAP code based on a different SAP table
  


ARTICLE
Standard SAP Help for SUBQUERY

sql_cond - subquery
Short Reference
• SELECT WHERE - subquery

Syntax
... ( SELECT result
FROM source
[WHERE sql_cond]
[GROUP BY group] [HAVING group_cond] ) ...

Effect
A subquery is a SELECT statement in parenthesis in which all additions except SINGLE, INTO, and ORDER BY can be used. A subquery with a single-column resulting set, in other words, the specification of the columns in the expression result of the subquery is limited to one column or to an aggregate expression, is known as a scalar subquery.
A subquery can be used within the following relational expressions sql_cond of the WHERE conditions for a subquery:
col operator [ALL|ANY|SOME] subquery
[NOT] EXISTS subquery
[NOT] IN subquery
Subqueries can be nested by using subqueries in the WHERE conditions of a subquery. In nested subqueries, the columns specified in the WHERE conditions are searched inside out, though the columns of inner subqueries conceal columns with the same name in outer subqueries.
A subquery that uses columns from the surrounding SELECT statement in its WHERE condition, is known as a correlated subquery. It must be possible to assign the column uniquely to a database table or view in the surrounding SELECT statement. A correlated subquery is evaluated for each individual line of the resulting set in the surrounding SELECT statement.
A maximum of 10 SELECT statements are permitted within one ABAP statement, in other words the SELECT itself and a maximum of 9 other subqueries. This restriction is independent of whether the subqueries are nested or occur in different relational expressions of the WHERE condition.

Notes
Subqueries cannot be used when accessing pooled tables or cluster tables.
With a correlated subquery, a projection view cannot be accessed in the surrounding SELECT statement.
If a subquery is used, the Open SQL statement bypasses SAP buffering.
In subqueries that are used in the WHERE condition of a DELETE or UPDATE statement, there may be no access to the database table to be changed.