SAP CDS ARITHMETIC EXPRESSION V2 Get Example source ABAP code based on a different SAP table
SAP Help
• + ABAP_CDS_OPERATOR_V2
• - ABAP_CDS_OPERATOR_V2
• * ABAP_CDS_OPERATOR_V2
• / ABAP_CDS_OPERATOR_V2
ABAP_CDS_DDL - CDS View Entity, arith_expr> ABAP_SYNTAX ... $[-$]operand1 $[+$|-$|*$|/ $[-$]operand2 $[+$|-$|*$|/ $[-$]operand3 ... $]$] ...> What does it do? Arithmetic expression in a SELECT > statement> of a CDS view entity>. An arithmetic expression uses arithmetic operators to calculate a numeric value from numeric operands. The possible operators are as follows: Operator>Meaning> +>Adds the operands ->Subtracts the right operand from the left *>Multiplies the operands />Divides the left operand by the right A minus sign (->) before an operand multiplies the operand by -1. The data type of the operands must be numeric and be based on one of the built-in data types> INT1>, INT2 >, INT4>, INT8>, DEC>, DECFLOAT16 >, DECFLOAT34>, FLTP>, or QUAN>. The following can be specified: Numeric literals> Numeric fields> of a data source data_source>> of the current CDS view entity Parameter> with numeric data type Path expressions> that identify a numeric field of a data source data_source>> Built-in functions> that return a numeric type SQL-based scalar functions> that return a numeric type Casting expressions> that return a numeric type Case distinctions> that return a numeric type Aggregate expressions> that return a numeric type Another arithmetic expression A reuse expression> using $projection> The subexpressions of an arithmetic expression can be placed in parentheses (...)>. The following table shows which data types can be combined using the operators +>, ->, and *> and the data type of the result: +>, ->, *>>INT1>>INT2 >>INT4>>INT8>>DEC>> DECFLOAT16>> DECFLOAT34>>FLTP>>QUAN>> INT1>>INT4>INT4>INT4>INT8> DEC>DECFLOAT16>DECFLOAT34 >-QUAN> INT2>>INT4>INT4>INT4>INT8> DEC>DECFLOAT16>DECFLOAT34 >-QUAN> INT4>>INT4>INT4>INT4>INT8> DEC>DECFLOAT16>DECFLOAT34 >-QUAN> INT8>>INT8>INT8>INT8>INT8> DEC>DECFLOAT16>DECFLOAT34 >-QUAN> DEC>>DEC>DEC>DEC>DEC> DEC>DECFLOAT16>DECFLOAT34> -QUAN> DECFLOAT16>>DECFLOAT16>DECFLOAT16> DECFLOAT16>DECFLOAT16>DECFLOAT16> DECFLOAT16>DECFLOAT16>DECFLOAT34>- DECFLOAT16> DECFLOAT34>> DECFLOAT34>DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34>- DECFLOAT34> FLTP>>-------FLTP>- QUAN>> QUAN>QUAN>QUAN>QUAN> QUAN>DECFLOAT16>DECFLOAT34>-*>: DECFLOAT34> lbr +>, ->: QUAN> The following table shows which data types can be combined using the operator /> and the data type of the result: />>INT1>INT2>INT4> INT8> DEC> DECFLOAT16>>DECFLOAT34>> FLTP>>QUAN> INT1>>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>-DECFLOAT34> INT2>>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>-DECFLOAT34> INT4>>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>-DECFLOAT34> INT8>>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>-DECFLOAT34> DEC>>DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>DECFLOAT34> DECFLOAT34 >DECFLOAT34>-DECFLOAT34> DECFLOAT16>>DECFLOAT34>DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT16 > DECFLOAT34>-DECFLOAT34> DECFLOAT34>>DECFLOAT34> DECFLOAT34> DECFLOAT34>DECFLOAT34>DECFLOAT34> DECFLOAT34 > DECFLOAT34 >-DECFLOAT34> FLTP>>-------FLTP>- QUAN>>DECFLOAT34>DECFLOAT34>