Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Operands and Expressions →  ABAP SQL - SQL Conditions sql_cond →  sql_cond - rel_exp for Statements 

sql_cond - BETWEEN

Other versions: 7.31 | 7.40 | 7.54

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 following applies for operand:
  • A column specified individually col cannot be numeric.
  • The following applies for operand1 and operand2:
  • Columns col need to have a numeric data type and they need to be prefixed with the name of the data source using ~. In this case, operand must also be numeric.
  • The content of ABAP objects, meaning literals, host variables, and host expressions 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 interval limits are included. 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).