ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP - Database Accesses → Open SQL → Open SQL - Read Accesses → SELECT → SELECT - cond → WHERE - sql_cond
sql_cond - BETWEEN
Other versions: 7.31 | 7.40 | 7.54
Syntax
... col [NOT] BETWEEN dobj1 AND dobj2 ...
Effect
This expression is true if the content of the column col
lies (not) between
the values of data objects dobj1
and dobj2
(interval limits enclosed). You can define no column descriptor for the interval limits.
Example
Readout of 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
INTO CORRESPONDING FIELDS OF TABLE sflight_tab
WHERE fldate BETWEEN sy-datum AND date.