ARTICLE
Short Reference
sql_cond - AND, OR, NOT
Syntax
... sql_cond1 AND sql_cond2 AND sql_cond3 ...
... sql_cond1 OR sql_cond2 OR sql_cond3 ...
... NOT sql_cond ...
Effect
Any number of logical expressions using AND or OR can be
joined to make one logical expression using sql_cond and the
result of a logical expression can be negated using NOT . The same
rules apply as for general logical
expressions. In particular an explicit use of parentheses is also
possible.
The following additional rules apply to logical expressions whose result
is unknown:
An AND join of two unknown expressions or one true expression
with an unknown expression produces an unknown expression. An AND
join of a false expression with an unknown expression produces a false
expression.
An OR join of two unknown expressions or one false expression
with an unknown expression produces an unknown expression. An OR
join of one true and one unknown expression produces a true expression.
The negation of an unknown expression with NOT produces an
unknown expression.
Notes
In particular, the expressions specified
dynamically as (cond_syntax) are also possible as logical
expressions within a join or negation.
The operator NOT in a WHERE clause cannot be supported by
an index . For this reason, we recommend that the
reverse comparison operator is used instead of NOT , for example
col = dobj instead of NOT col dobj .
Example
Reads flights from Frankfurt to Los Angeles or San Francisco.
DATA spfli_tab TYPE TABLE OF spfli.
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE cityfrom = 'FRANKFURT' AND
( cityto = 'LOS ANGELES' OR
cityto = 'SAN FRANCISCO' ).
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved