Ansicht
Dokumentation

ABENUTCLONG_ADD - UTCLONG ADD

ABENUTCLONG_ADD - UTCLONG ADD

RFUMSV00 - Advance Return for Tax on Sales/Purchases   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- utclong_add

... utclong_add( val  = time_stamp [days = days]
                                   [hours = hours]
                                   [minutes = minutes]
                                   [seconds = seconds] ) ...


Effect

This built-in function adds the values passed to the optional parameters as a time stamp specified after val. The type of the return value is utclong.

A time stamp field of the type utclong that contains a valid time stamp must be passed to the argument val. time_stamp is a time-stamp-like expression position. An initial time stamp is handled like the smallest possible value of a time stamp.

The values to be added are passed in the following parameters, of which at least one must be specified:

  • days expects a number of days as a number of the type i.
  • hours expects a number of hours as a number of the type i.
  • minutes expects a number of minutes as a number of the type int8.
  • seconds expects a number of seconds as a number of the type decfloat34.

Each parameter can be passed data objects that can be converted to the expected type. Positive and negative numbers can be passed. These are numeric expression positions. Internally, the passed values are transformed to the corresponding number of seconds, whereby the value passed to seconds is rounded to seven decimal places. First, the days, hours, and minutes, and then seconds are added to or subtracted from the value of the time stamp. If an invalid time stamp value is produced by one of the intermediate steps, a catchable exception of the class CX_SY_ARITHMETIC_OVERFLOW is raised.

Notes

  • utclong_subtract is not available, since its function is achieved by passing negative numbers to the parameter utclong_add.
  • There are no parameters for years and months, since they do not correspond to a fixed number of seconds.
  • The result of the function utclong_add is never the initial value of a time stamp. It is either a valid time stamp value or an exception is raised.

Example

This example demonstrates how the function utclong_add works. The corresponding number of seconds is subtracted from a time stamp field ts_new, which itself is produced by adding days, hours, and minutes. The statement ASSERT demonstrates how this produces the original time stamp again.

Example

This example demonstrates how the initial value is handled. One second is added to a time stamp ts_ini passed as an initial value and one second is subtracted from the result in ts_1. The result ts_0 is the smallest valid time stamp value and not the initial value.

Example

This example shows how missing days due to the switch from the Julian to the Gregorian calendar are handled. Adding 100 ns to the time stamp "1582-10-04 23:59:59.9999999" produces the time stamp "1582-10-15T00:00:00.0000000".

Exceptions

Catchable Exceptions

CX_SY_CONVERSION_NO_DATE_TIME

  • Cause: The time stamp specified for val is invalid.
    Runtime Error: INVALID_UTCLONG

CX_SY_CONVERSION_ERROR

  • Cause: A passed parameter cannot be converted to the expected type.
    Runtime Error: CONVT_OVERFLOW, BCD_OVERFLOW

CX_SY_ARITHMETIC_OVERFLOW

  • Cause: The parameters passed produce an invalid time stamp.
    Runtime Error: UTCLONG_ADD_OVERFLOW

Non-Catchable Exceptions

  • Cause: An argument without a time stamp type is bound to val.
    Runtime Error: TCHK_TYPE_LOAD





RFUMSV00 - Advance Return for Tax on Sales/Purchases   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 6050 Date: 20240419 Time: 152452     sap01-206 ( 80 ms )