AS ABAP Release 753, ©Copyright 2019 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Operands and Expressions → ABAP SQL - Conditions sql_cond → sql_cond - rel_exp for Statements →sql_cond - BETWEEN
Syntax
... operand [NOT] BETWEEN operand1 AND operand2 ...
Effect
This relational expression is true if the content of the operand operand is (is not) between the values of the operands operand1 and operand2.
The interval limits are included. The content of operand1 and operand2 must match the data type of operand in accordance with the rules for lossless assignments. This is also 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] ( operand >= operand1 AND operand <= operand2 ) ...
and the corresponding rules and notes apply.
Example
Reads all flights within the next 30 days.
DATA(date) = conv d( sy-datum + 30 ).
SELECT carrid, connid, fldate
FROM sflight
WHERE fldate BETWEEN @sy-datum AND @date
INTO TABLE @DATA(sflight_tab).