Entering content frame

Selection Tables in the WHERE Clause Locate the document in its SAP Library structure

The WHERE clause is an option of the Open SQL statements SELECT, UPDATE and DELETE, and is used to restrict the values read during database accesses.

To use a selection table in the WHERE clause, you write:

......... WHERE f IN seltab.

f is the name of a database column, and seltab is the selection table that is assigned to this field. The relevant Open SQL statement accesses only those rows of the database table, where the contents of field f meet the selection criteria stored in seltab.

Example

REPORT demo_where_in_seltab.

DATA wa_carrid TYPE spfli-carrid.

SELECT-OPTIONS airline FOR wa_carrid.

SELECT carrid FROM spfli INTO wa_carrid WHERE carrid IN airline.
  WRITE / wa_carrid.
ENDSELECT.

Selection table airline is linked to the CARRID column of database table SPFLI. The WHERE clause of the SELECTstatement checks if the contents of the CARRID column meet the selection criteria stored in airline.

If the selection table is filled as follows, the database rows for all airlines between DL and UA are read, with the exception of LH.

SIGN

OPTION

LOW

HIGH

I

BT

DL

UA

E

EQ

LH

 

 

 

Leaving content frame