Entering content frameSelection Tables in the WHERE Clause Locate the document in its SAP Library structure

The WHERE clause is an addition to 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.

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 SELECT statement checks if the contents of the CARRID column meet the selection criteria stored in AIRLINE.

If the selection table is filled as follows:

SIGN

OPTION

LOW

HIGH

I

BT

DL

UA

E

EQ

LH

 

Then the database rows for all airlines between DL and UA except LH are read.

 

 

 

 

Leaving content frame