What does it do? 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.
Latest 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. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 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. ABEXA 01372 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 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. ABEXA 01373 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 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>. ABEXA 01374 ABAP_EXAMPLE_END