SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Accesses → Open SQL → Open SQL - Read Accesses → SELECT → SELECT - WHERE → WHERE - sql_cond →sql_cond - IN seltab
Syntax
... col [NOT] IN seltab ...
Effect
This expression is true if the value of the column col is (not) in the result set described in the rows of the selection table seltab. Any internal table with a row type that corresponds to that of a selection table can be specified as the selection table seltab. This includes, in particular, ranges tables.
The selection table is evaluated in the same way as in comparison expressions apart from the fact that in comparisons with the operators CP and NP the WHERE condition is case-sensitive, whereas in other comparison expressions it is not. The wildcard characters "*" and "+" of the selection options "CP" and "NP" are converted to the OpenSQL wildcard characters "%" and "_", whereby the escape character "#" is also handled correctly. If "%" and "_" are contained in the template, an OpenSQL escape character is generated.
Notes
Example
A selection table is filled as follows (the order of the rows is not important):
The following WHERE condition is generated from this:
Example
Reads flights with a primary key that corresponds to the user entries on the selection screen.
DATA spfli_wa TYPE spfli.
SELECT-OPTIONS: s_carrid FOR spfli_wa-carrid NO INTERVALS
NO-EXTENSION,
s_connid FOR spfli_wa-connid NO INTERVALS
NO-EXTENSION.
SELECT SINGLE *
FROM spfli
INTO spfli_wa
WHERE carrid IN s_carrid AND
connid IN s_connid.