sapdev logo background
sapdev logo sapdev logo
Comments

SAP NUMERICAL FUNCTIONS documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

abs , sign , ceil , floor , trunc ,
frac - Numerical Functions
The following table shows the general numerical functions for a single unnamed argument with any numerical data type. These functions are overloaded with the effect that the return value can have different numerical types.

Syntax
... func( arg ) ...

Effect
The argument of a general numerical function must be an individual data object outside an arithmetic expression, and can itself be a numeric expression within an arithmetic expression.
Effect of the general numerical functions.
Function func Return Value
ABAP_KEY abs Absolute value of argument arg
ABAP_KEY sign Sign of argument arg : -1, if the value of arg is negative; 0, if the value of arg is 0; 1, if the value of arg is positive
ABAP_KEY ceil Smallest integer that is not less than the value of the argument arg is
ABAP_KEY floor Largest integer that is not greater than the value of the argument arg is
ABAP_KEY trunc Value of the integer part of the argument
arg
ABAP_KEY frac Value of the
decimal places of the argument arg

The following applies with regard to the data type of the return value:
  • With the exception of an

  • arithmetic expression , the data type of the argument determines the data type of the return value.
  • Within an arithmetic expression, the argument of the function contributes to the calculation type of the entire expression and the function is calculated using the calculation type. If the argument itself is an arithmetic expression, its operands contribute to the entire calculation type and the argument is also calculated with this type.

  • If the argument arg is a

  • numeric expression , the function works like an arithmetic operator and it is handled in its operand position like an arithmetic expression .
    If the argument of a numerical function outside of an arithmetic expression has no numerical data type, i ,
    int8 , p , decfloat16 , decfloat34 , or f its data type determines the type of return value as follows:
  • d and t give i

  • c , n and string give p

  • x and xstring give i

  • Before the calculation of the function, the argument is converted into the respective type. .

    Note
    The functions described here are some of the functions that can be used in the obsolete extended functional operand positions , even if their argument is a single data object.

    Example
    For a demonstration of the numeric functions, see Numeric Functions .
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    NUMERICAL_EXPR_POSITION_GLOSRY
    NUMERICAL_FUNCTIONS_ABEXAS




    comments powered by Disqus