ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Data Definitions → ABAP CDS - DDL for Data Definitions → ABAP CDS - DEFINE VIEW → ABAP CDS - SELECT → ABAP CDS - SELECT, Operands and Expressions → ABAP CDS - cond_expr → ABAP CDS - cond_expr, Relational Operators
ABAP CDS - cond_expr, Comparable Types
The following tables show which built-in data types in ABAP Dictionary can be compared with each other in a condition of a CDS view.
Other versions:
7.31 | 7.40 | 7.54
Comparisons with Fields of Data Sources
The following table shows the possible combinations of data source fields data_source on the left side (lhs) with data source fields on the right side (rhs) of comparisons.
lhs/rhs | INT1 | INT2 | INT4 | INT8 | DEC | CURR | QUAN | DECFLOAT16 | DECFLOAT34 | FLTP | CHAR | SSTRING | NUMC | CLNT | LANG | DATS | TIMS | DATN | TIMN | UTCLONG | ACCP | UNIT | CUKY | RAW |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
INT1 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT2 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT4 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT8 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DEC | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CURR | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
QUAN | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DECFLOAT16 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DECFLOAT34 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
FLTP | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CHAR | - | - | - | - | - | - | - | - | - | - | x | x | x | l | x | x | x | - | - | - | x | x | x | - |
SSTRING | - | - | - | - | - | - | - | - | - | - | x | x | - | - | x | - | - | - | - | - | x | x | x | - |
NUMC | - | - | - | - | - | - | - | - | - | - | x | - | l | l | - | l | l | - | - | - | - | - | - | - |
CLNT | - | - | - | - | - | - | - | - | - | - | l | - | l | x | - | - | - | - | - | - | - | - | - | - |
LANG | - | - | - | - | - | - | - | - | - | - | x | x | - | - | x | - | - | - | - | - | - | - | - | - |
DATS | - | - | - | - | - | - | - | - | - | - | x | - | l | - | - | x | - | - | - | - | - | - | - | - |
TIMS | - | - | - | - | - | - | - | - | - | - | x | - | l | - | - | - | x | - | - | - | - | - | - | - |
DATN | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - | - | - |
TIMN | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - | - |
UTCLONG | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - |
ACCP | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | - | - | x | - | - | - |
UNIT | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | - | - | - | x | - | - |
CUKY | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | - | - | - | - | x | - |
RAW | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | l |
- There are no restrictions for combinations using "x".
- In combinations using "l", the lengths of the compared columns must match exactly.
Comparisons with Parameters
The following table shows the possible combinations of data source fields data_source on the left side (lhs) with parameters on the right side (rhs) of comparisons.
lhs/rhs | INT1 | INT2 | INT4 | INT8 | DEC | CURR | QUAN | DECFLOAT16 | DECFLOAT34 | FLTP | CHAR | SSTRING | NUMC | CLNT | LANG | DATS | TIMS | DATN | TIMN | UTCLONG | ACCP | UNIT | CUKY | RAW |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
INT1 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT2 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT4 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
INT8 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DEC | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CURR | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
QUAN | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DECFLOAT16 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
DECFLOAT34 | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
FLTP | x | x | x | x | x | x | x | x | x | x | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CHAR | - | - | - | - | - | - | - | - | - | - | x | x | x | l | x | x | x | - | - | - | - | x | x | - |
SSTRING | - | - | - | - | - | - | - | - | - | - | x | x | - | - | x | - | - | - | - | - | - | x | x | - |
NUMC | - | - | - | - | - | - | - | - | - | - | x | - | l | l | - | l | l | - | - | - | - | - | - | - |
CLNT | - | - | - | - | - | - | - | - | - | - | l | - | l | x | - | - | - | - | - | - | - | - | - | - |
LANG | - | - | - | - | - | - | - | - | - | - | x | x | - | - | x | - | - | - | - | - | - | - | - | - |
DATS | - | - | - | - | - | - | - | - | - | - | x | - | l | - | - | x | - | - | - | - | - | - | - | - |
TIMS | - | - | - | - | - | - | - | - | - | - | x | - | l | - | - | - | x | - | - | - | - | - | - | - |
DATN | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - | - | - |
TIMN | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - | - |
UTCLONG | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | x | - | - | - | - |
ACCP | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | - | - | - | - | - | - |
UNIT | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | - | - | - | x | - | - |
CUKY | - | - | - | - | - | - | - | - | - | - | x | x | - | - | - | - | - | - | -- | - | - | x | - | |
RAW | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | l |
- There are no restrictions for combinations using "x".
- In combinations using "l", the lengths of the compared operands must match exactly.
Comparisons with literals
The following table shows the possible combinations of data source fields data_source on the left side (lhs) with literals on the right side (rhs) of comparisons function. The data types of literals are determined by the content of literals (as described here) and only the data types displayed in the table are possible.
lhs/rhs | INT1 | INT2 | INT4 | FLTP | CHAR | NUMC |
---|---|---|---|---|---|---|
INT1 | x | y | - | - | - | - |
INT2 | x | x | z | - | - | - |
INT4 | x | x | x | - | - | - |
INT8 | x | x | x | - | - | - |
DEC | x | x | x | d | - | - |
CURR | l | l | l | d | - | - |
QUAN | l | l | l | d | - | - |
DECFLOAT16 | x | x | x | - | - | - |
DECFLOAT34 | x | x | x | - | - | - |
FLTP | - | - | - | - | - | - |
CHAR | - | - | - | - | m | m |
SSTRING | - | - | - | - | m | - |
NUMC | - | - | - | - | - | l |
CLNT | - | - | - | - | - | l |
LANG | - | - | - | - | l | l |
DATS | - | - | - | - | - | l |
TIMS | - | - | - | - | - | l |
ACCP | - | - | - | - | - | l |
UNIT | - | - | - | - | m | - |
CUKY | - | - | - | - | m | - |
RAW | - | - | - | - | - | - |
- There are no restrictions for combinations using "x".
- For the combination using "y", the literal value must be between 0 and 999. For the combination using "z", the literal value must be between -99999 and +99999.
- For combinations using "m", the length of the literal cannot be larger than the column.
- For combinations using "d", the length of the literal and the number of decimal places cannot be larger than the length and number for the column.
- For combinations using "l", the length of the literal must be equal to the length of the column.