SAP CDS SQL FUNCTIONS NUMERIC V1



Get Example source ABAP code based on a different SAP table
  


• ABS ABAP_CDS_FUNCTION_V1
• CEIL ABAP_CDS_FUNCTION_V1
• DIV ABAP_CDS_FUNCTION_V1
• DIVISION ABAP_CDS_FUNCTION_V1
• FLOOR ABAP_CDS_FUNCTION_V1
• MOD ABAP_CDS_FUNCTION_V1
• ROUND ABAP_CDS_FUNCTION_V1

ABAP_CDS_DDL - DDIC-Based View, Numeric Functions
The following table shows the possible numeric SQL functions in a ABAP_CDS_V1_VIEW , plus the requirements made on the arguments. FunctionResultValid Argument Types Result Type
ABS(arg)Absolute amount of arg INT1, INT2, INT4, INT8, DEC, CURR, QUAN, FLTPData 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, FLTPINT4, 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. ABAP_EXCEPTION 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, QUANData 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, INT8Data 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. ABAP_EXCEPTION If arg is of data type INT1 or INT2, the result is converted to INT4.