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 - BETWEEN

Other versions: 7.31 | 7.40 | 7.54


... col [NOT] BETWEEN dobj1 AND dobj2 ...


This expression is true if the content of the column col is (not) between the values of the host variables or literals dobj1 and dobj2. The interval limits are included. Column names cannot be specified for the interval limits. The name of a host variable should be prefixed with the escape character @. The content of dobj1 and 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.

The comparison is made in the same way as for

... [NOT] ( col >= dobj1 AND col <= dobj2 ) ...

and the corresponding rules and notes apply.


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.


Reads all flights within the next 30 days.

TYPES: BEGIN OF sflight_tab_type, 
         carrid TYPE sflight-carrid, 
         connid TYPE sflight-connid, 
         fldate TYPE sflight-fldate, 
       END OF sflight_tab_type. 

DATA: sflight_tab TYPE TABLE OF sflight_tab_type, 
      date        TYPE d. 

date = sy-datum + 30. 

SELECT carrid, connid, fldate 
       FROM sflight 
       WHERE fldate BETWEEN @sy-datum AND @date