SAP WHERE LOGEXP COMPARE TYPES



Get Example source ABAP code based on a different SAP table
  



ABAP_SQLCOND - Comparable Types
The following table shows which built-in data types in the ABAP Dictionary can be compared with each other. The table applies to the following:
Comparisons of a WHERE condition or HAVING condition in which SQL expressions are specified on the left side ( lhs) and columns are specified on the right side (rhs).
Comparisons of an ON condition.
Comparisons in expressions.
Invalid comparisons produce a syntax error
BEGIN_SECTION VERSION 5 OUT in conditions of an expression and in the ABAP_STRICT_740_SP08 strict mode from ABAP_RELEASE ABAP_740_SP08 /
END_SECTION VERSION 5 OUT .
BEGIN_SECTION VERSION 5 OUT In other cases, a syntax warning is produced. The result of invalid comparisons is determined by the database system and is platform-dependent. For details on comparisons on SAP HANA Platform, see the SAP HANA SQL Reference Guide.
END_SECTION VERSION 5 OUT lhs/rhsINT1INT2INT4 INT8DECCURR QUANDECFLOAT16DF16_DEC DF16_RAWDECFLOAT34DF34_DEC DF34_RAWFLTPCHAR SSTRINGNUMCCLNTLANG DATSTIMSACCP UNITCUKYDATNTIMN UTCLONGRAW
INT1xxxxxxxxy-xy------ ----------
INT2xxxxxxxxy-xy------ ----------
INT4xxxxxxxxy-xy------ ----------
INT8xxxxxxxxy-xy------ ----------
DECxxxxxxxxy-xy------ ----------
CURRxxxxxxxxy-xy------ ----------
QUANxxxxxxxxy-xy------ ----------
DECFLOAT16xxxxxxxxy-xy---- ------------
DF16_DECyyyyyyyyz--y---- ------------
DF16_RAW---------x------ ------------
DECFLOAT34xxxxxxxxy-xy---- ------------
DF34_DECyyyyyyyyy--z---- ------------
DF34_RAW------------x--- ------------
FLTP-------------x---- ----------
CHAR--------------xxxx xxxyxxyy--
SSTRING--------------xxx xxeeyxx----
NUMC--------------xxxx xeeyxx----
CLNT--------------xxxx xeeyxx----
LANG--------------xxxx xeeyxx----
DATS--------------xeee exe-eey---
TIMS--------------xeee eex-ee-y--
ACCP--------------yyyy y--yyy----
UNIT--------------xxxx xeeyxx----
CUKY--------------xxxx xeeyxx----
DATN--------------y--- -y----x---
TIMN--------------y--- --y----x--
UTCLONG----------------- ---------=-
RAW------------------ ---------l, y
There are no restrictions for combinations using x.
Combinations with y cannot be used in conditions in an expression.
In combinations with z, the lengths and decimal places must match in the compared columns or expressions in conditions in an expression.
Combinations with e can only be used in conditions in an expression and cannot be used in conditions for a statement.
In combinations with l, the lengths of the compared columns or expressions must match.
In conditions in an expression, combinations with = can only be compared for equality.
The comparability of dictionary types is significant for comparisons with columns or SQL expressions on the right side or for comparisons in SQL expressions. This applies in particular to literals, host variables, and host expressions when handled as elementary SQL expressions. These elements are mapped to a dictionary type and comparability is identified for the dictionary type in question.



Latest notes:

Any literals, host variables, and host expressions that are not handled as elementary SQL expressions are usually converted to the matching dictionary type instead of being mapped to a dictionary type. For example, it may be possible to compare a host variable as the right side of a relational expression for statements with more dictionary types than in a relational expression for SQL expressions .
SQL expressions of the types DF16_DEC or DF34_DEC are compared with other numeric types other than themselves.
SQL expressions of the type SSTRING are compared with types other than themselves in a CASE expression.
NON_V5_HINTS
The table does not show the obsolete types DF16_SCL and DF34_SCL, which cannot be compared in conditions in an expression and, like DF16_RAW and DF34_RAW, can otherwise only be compared with themselves.
In the following cases, the syntax check is performed in a ABAP_STRICT_762 strict mode / , which handles the statement more strictly than the regular syntax check.
ABAP_HINT_END