SAP SQL ARITH FUNC



Get Example source ABAP code based on a different SAP table
  


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

ABAP_SQLFUNC - Numeric Functions

ABAP_SYNTAX
... func( arg1$[, arg2$] ... ) ...

What does it do?
Calls an numeric function func as an SQL expression or operand of an expression in AB_SQL . The arguments arg1, arg2, ... of the function are specified as a comma-separated list in parentheses. A blank must be placed after the opening parenthesis and in front of the closing parenthesis.
The following table shows the numeric functions that can be specified as SQL expressions and the requirements on the arguments. The meaning of the functions can be found under SQL Functions for Numeric Values. The value x in the Table Buffer column indicates that the function can be executed in the table buffer and that the use of this function does not bypass table buffering. SyntaxResultValid Argument TypesResult Type Table Buffer ABS( sql_exp )Absolute amount of sql_expAll numeric types except the replacement types for decimal floating point numbers Type of the argumentx CEIL( sql_exp ) Rounded to the first integer that is greater than or equal to the value of sql_expDECFLOAT16 and DECFLOAT34 as well as DEC, CURR, and QUAN with decimal placesDEC without decimal places in the length of the resultx DIV( sql_exp1,sql_exp2 ) The result of a division of sql_exp1 by sql_exp2 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 the same sign, and negative if the arguments have different signs. ABAP_EXCEPTION sql_exp2 has the value 0. INT1 , INT2, INT4, and INT8 plus DEC, CURR , and QUAN without decimal placesType of the argument with the greatest value range.x DIVISION( sql_exp1,sql_exp2,dec ) Division of sql_exp1 by sql_exp2. The result is rounded to dec decimal places.sql_exp1, sql_exp2: INT1, INT2, INT4, INT8, DEC, CURR , and QUAN lbr lbr dec: Literal or host constant with ABAP type b, s, i , int8 greater than or equal to 0 and not greater than the maximum value of 6 and the length of sql_exp2 plus the number of decimal places of sql_exp1 plus 1DEC with dec decimal places. The length of the result is the length of sql_exp1 minus the decimal places in sql_exp1 plus the decimal places in sql_exp2 plus dec. This value must not be greater than 31.- FLOOR( sql_exp ) Largest integer number not greater than the value of sql_exp DECFLOAT16 and DECFLOAT34 as well as DEC, CURR, and QUAN with decimal placesDEC without decimal places in the length of the resultx MOD( sql_exp1,sql_exp2 ) Positive or negative integer remainder of the division of sql_exp1 by sql_exp2 INT1, INT2, INT4, and INT8 plus DEC, CURR, and QUAN without decimal placesType of the argument with the greatest value range.x ROUND( sql_exp,pos ) Rounded value of sql_exp. 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. sql_exp: INT1, INT2, INT4, INT8, DEC, CURR, and QUAN lbr lbr pos: INT1, INT2, INT4, and null expressionType of sql_exp, where INT1 and INT2 are updated after INT4, and CURR and QUAN are converted to DEC.-
The arguments sql_exp, sql_exp1, sql_exp3, and pos can be any SQL expressions with the appropriate data types. The possible types are specified as built-in dictionary types. The possible data types for literals, host variables, and host expressions are the ABAP types assigned to the dictionary types above.
If an argument of a numeric function has the null value, the result of the full numeric function is the null value.



Latest notes: