Get Example source ABAP code based on a different SAP table
ABAP_CDS_DDL - CDS View Entity, cds_cond>, 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 entity>. ITOC
Comparisons with Fields of Data Sources The following table shows the possible combinations of data source fields 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>>xxxxx-axxx-------- ------ INT2>>xxxxx-axxx-------- ------ INT4>>xxxxx-axxx-------- ------ INT8>>xxxxx-axxx-------- ------ DEC>>xxxxx-axxx-------- ------ CURR>>-----d------------ ------ QUAN>>aaa-a-aaaa-------- ------ DECFLOAT16>>xxxxx-axxx------ -------- DECFLOAT34>>xxxxx-axxx------ -------- FLTP>>xxxxx-axxx-------- ------ CHAR>>----------xxmlxxx- --xxx- SSTRING>>----------xx--x-- ---xxx- NUMC>>----------m-ll-ll- ------ CLNT>>----------l-lx---- ------ LANG>>----------xx--x--- ------ DATS>>----------x-l--x-- ------ TIMS>>----------x-l---x- ------ DATN>>-----------------x ------ TIMN>>------------------ x----- UTCLONG>>----------------- --x---- ACCP>>----------xx------ --x--- UNIT>>----------xx------ ---x-- CUKY>>----------xx------ ----x- RAW>>------------------ -----l
There are no restrictions for combinations using x>.
In combinations using l>, the lengths of the compared columns must match exactly.
For combinations using m>, the length is relevant: the field of type NUMC> can have the same lengths or fewer characters than the field of type CHAR>. If the field of type NUMC> is longer than the field of type CHAR >, a syntax error occurs.
For combinations using d>, the number of decimal places must match exactly.
ABAP_NOTE Operands of data type CURR> can be cast to data type DECFLOAT34> using the conversion function CURR_TO_DECFLOAT_AMOUNT >> to avoid length requirements.
For combinations using a>, both operands must be specified as ABAP CDS quantity fields> by adding a reference to a unit of measurement key> using the annotation @Semantics.quantity.unitOfMeasure>>. Otherwise, a syntax check warning occurs.
ABAP_NOTE You can use the conversion function GET_NUMERIC_VALUE >> to turn quantity fields into regular fields of data type DECFLOAT34>.
Comparisons with Parameters The following table shows the possible combinations of data source fields 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>>xxxxx-xxxx-------- ------ INT2>>xxxxx-xxxx-------- ------ INT4>>xxxxx-xxxx-------- ------ INT8>>xxxxx-xxxx-------- ------ DEC>>xxxxx-xxxx-------- ------ CURR>>-----d------------ ------ QUAN>>------x----------- ------ DECFLOAT16>>xxxxx-xxxx------ -------- DECFLOAT34>>xxxxx-xxxx------ -------- FLTP>>xxxxx-xxxx-------- ------ CHAR>>----------xxmlxxx- ---xx- SSTRING>>----------xx--x-- ----xx- NUMC>>----------m-ll-ll- ------ CLNT>>----------l-lx---- ------ LANG>>----------xx--x--- ------ DATS>>----------x-l--x-- ------ TIMS>>----------x-l---x- ------ DATN>>-----------------x ------ TIMN>>------------------ x----- UTCLONG>>----------------- --x---- ACCP>>----------xx------ ------ UNIT>>----------xx------ ---x-- CUKY>>----------xx----- -----x- RAW>>------------------ -----l
There are no restrictions for combinations using x>.
In combinations using l>, the lengths of the compared operands must match exactly.
For combinations using m>, the length is relevant: the field of type NUMC> can have the same lengths or less characters than the field of type CHAR>. If the field of type NUMC> is longer than the field of type CHAR >, a syntax error occurs.
For combinations using d>, the number of decimal places must match exactly.
ABAP_NOTE Operands of data type CURR> can be cast to data type DECFLOAT34> using the conversion function CURR_TO_DECFLOAT_AMOUNT >> to avoid this length requirement.
Comparisons with Literals The following table shows the possible combinations of data source fields on the left side (lhs>) with literals on the right side ( rhs>) of comparisons. The literals can be typed> or untyped>. It is recommended that only typed literals are used, because they offer more data types. With typed literals, the data types shown in the table are possible. lhs/rhs>INT1>>