Ansicht
Dokumentation

ABENSQL_ARITH_FUNC - SQL ARITH FUNC

ABENSQL_ARITH_FUNC - SQL ARITH FUNC

PERFORM Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- Numeric Functions

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

Effect

Calls an numeric function func as an SQL expression or operand of an expression in . 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.

Syntax Result Valid Argument Types Result Type Table Buffer
ABS( sql_exp ) Absolute amount of sql_exp All numeric types except the replacement types for decimal floating point numbers Type of the argument x
CEIL( sql_exp ) Rounded to the first integer that is greater than or equal to the value of sql_exp DECFLOAT16 and DECFLOAT34 as well as DEC, CURR, and QUAN with decimal places DEC without decimal places in the length of the result x
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. sql_exp2 has the value 0. INT1, INT2, INT4, and INT8 plus DEC, CURR, and QUAN without decimal places Type 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 1 DEC 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 places DEC without decimal places in the length of the result x
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 places Type 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, and INT4 Type 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.

Note

See Example.

Example

Conversion of flight time from minutes to hours.

SQL Expressions, Arithmetic Calculations






General Material Data   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 8525 Date: 20240420 Time: 162646     sap01-206 ( 99 ms )