Ansicht
Dokumentation

ABENCDS_SQL_FUNCTIONS_NUMERIC_V2 - CDS SQL FUNCTIONS NUMERIC V2

ABENCDS_SQL_FUNCTIONS_NUMERIC_V2 - CDS SQL FUNCTIONS NUMERIC V2

ABAP Short Reference   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

- CDS View Entity, Numeric Functions

The following table shows the possible numeric SQL functions in a CDS view entity, plus the requirements made on the arguments.

Function Result Valid Argument Types Result Type
ABS(arg) Absolute amount of arg INT1, INT2, INT4, INT8, DEC, CURR, QUAN, DECFLOAT16, DECFLOAT34, FLTP Data type of arg
CEIL(arg) Returns the first integer that is greater than or equal to the value of arg DEC, DECFLOAT16, DECFLOAT34 Data type of arg
DIV(arg1, arg2) The result of a division of arg1 by arg2 is rounded to an integer. The sign is assigned after the amounts are divided; positive if the arguments have the same sign, and negative if the arguments have different signs. arg2 has the value 0. INT1, INT2, INT4, INT8, DEC. Data type of the argument with the greatest value range
DIVISION(arg1, arg2, dec) Division of arg1 by arg2. The result is rounded to dec decimal places. arg1, arg2: INT1, INT2, INT4, INT8, DEC \lbr\lbr dec: integer numeric literal greater than or equal to 0. Length must be suitable so that the total of 31 valid places is not exceeded. DEC with dec decimal places. The length of the result must not be greater than 31.
FLOOR(arg) Returns the largest integer number not greater than the value of arg. Counterpart to CEIL. DEC, DECFLOAT16, DECFLOAT34 Data type of arg
MOD(arg1, arg2) Positive or negative integer remainder of the division of arg1 by arg2. arg1: INT1, INT2, INT4, INT8\lbr \lbr arg2: INT1, INT2, INT4 Data type of arg1
ROUND(arg, pos) Rounded value of arg. If pos is greater than 0, the value is rounded to the position pos on the right of the decimal separator. If this is not the case, position abs(pos)+1 to the left of the decimal separator is rounded. This results in a 0 if the number of places is not sufficient. arg: INT1, INT2, INT4, INT8, DEC, CURR, QUAN, DECFLOAT16, DECFLOAT34 \lbr\lbr pos: Literal, field of a data source or input parameter of type INT1, INT2, or INT4 When arg has data type INT1, INT2, or INT4, then the result has data type INT4. For all other data types, the result has the same data type as arg.

The following can be specified as the arguments arg:

  • The following built-in functions and expressions (if they return a matching type):

  • Type modifications using CAST

Notes

  • Currently, CURR and QUAN cannot be used with minus sign.
This syntax is not valid: ABS(-curr).

Example

The following CDS view entity applies built-in numeric SQL functions in the SELECT list to columns of the DDIC database table DEMO_EXPRESSIONS. The program DEMO_CDS_SQL_FUNCTIONS_NUM_VE uses SELECT to access the view.






ROGBILLS - Synchronize billing plans   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 13309 Date: 20240501 Time: 234729     sap01-206 ( 157 ms )