Ansicht
Dokumentation

ABENNUMERICAL_FUNCTIONS - NUMERICAL FUNCTIONS

ABENNUMERICAL_FUNCTIONS - NUMERICAL FUNCTIONS

Addresses (Business Address Services)   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

- abs, sign, ceil, floor, trunc, frac

... num_func( arg ) ...

Effect

General built-in numeric functions for exactly one unnamed argument with any numeric data type. These functions are overloaded with the effect that the return value can have different numeric types. The argument of a general numeric function must be a single data object outside an arithmetic expression, and can itself be a numeric expression within an arithmetic expression.

The following table shows the general numeric functions and how they work.

Function num_func Return Value
abs Absolute value of argument arg
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
ceil Smallest integer that is not less than the value of the argument arg
floor Largest integer that is not greater than the value of the argument arg
trunc Value of the integer part of the argument arg; negative if arg is negative
frac Value of the decimal places of the argument arg; negative if arg is negative

The following applies to the data type of the return value:

  • Outside 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 of a numeric function outside of an arithmetic expression does not have a numeric 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 givei
  • utclong is not allowed

Before the calculation of the function, the argument is converted to the corresponding type.

Notes

  • The time stamp type utclong cannot be converted implicitly to a numeric type, and therefore cannot be specified directly as an argument.

Example

The following assertion should always be correct.

Numeric Functions






PERFORM Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 4931 Date: 20240419 Time: 225945     sap01-206 ( 100 ms )