Ansicht
Dokumentation
ABENCDS_SQL_FUNCTIONS_NUMERIC_V1 - CDS SQL FUNCTIONS NUMERIC V1
PERFORM Short Reference ABAP Short ReferenceThis documentation is copyright by SAP AG.
- DDIC-Based View, Numeric Functions
The following table shows the possible numeric SQL functions in a , 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, FLTP | Data type of arg |
CEIL(arg) | Rounded to the first integer that is greater than or equal to the value of arg | INT1, INT2, INT4, INT8, DEC, CURR, QUAN, FLTP | INT4, INT8 (if arg is of type INT8) |
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, CURR, QUAN without decimal places. | 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, CURR, QUAN \lbr\lbr dec: integer numeric literal greater than or equal to 0 and not greater than the maximum value of 6 and the length of arg2 plus the number of decimal places of arg1 plus 1 | DEC with dec decimal places. The length of the result is the length of arg1 minus the decimal places in arg1 plus the decimal places in arg2 plus dec. This value must not be greater than 31. |
FLOOR(arg) | Largest integer number not greater than the value of arg | INT1, INT2, INT4, INT8, DEC, CURR, QUAN | Data type of arg for the integer types, else DEC without decimal places |
MOD(arg1, arg2) | Positive or negative integer remainder of the division of arg1 by arg2 | INT1, INT2, INT4, INT8 | 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 \lbr\lbr pos: Literal, field of a data source or input parameter of type INT1, INT2, or INT4 | Data type of arg. If arg is of data type INT1 or INT2, the result is converted to INT4. |
Note
See Example.
Example
The following CDS view 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 uses SELECT to access the view.
PERFORM Short Reference rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 11398 Date: 20240329 Time: 063624 sap01-206 ( 178 ms )