Skip to content

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

Other versions: 7.31 | 7.40 | 7.54

Syntax


... col [NOT] IN (dobj1, dobj2 ... ) ...

Effect

This expression is true if the value of the column col matches (does not match) the content of a host variable or a literal in a value list. The value list is specified as a list of elementary objects in parentheses and separated by commas dobj1, dobj2 .... The name of a host variable should be prefixed with the escape character @. The content of dobj1, dobj2, ... should match the data type of the column in accordance with the rules for lossless assignments. This is checked by the strict modes of the syntax check from Release 7.40, SP08 and can raise an exception.


Note

Host variables without the escape character @ are obsolete. The escape character @ must be specified in the strict modes of the syntax check from Release 7.40, SP05.


Example

Reads the bookings in which the class is not in the value range (C - Business, F - First, Y - Economy) of the corresponding domain in ABAP Dictionary.

SELECT * 
       FROM sbook 
       WHERE class NOT IN ('C','F','Y') 
       INTO TABLE @DATA(sbook_tab). 

IF sy-subrc = 0. 
  "Error handling 
ENDIF.