ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Date and Time Processing → Time Stamp
GET TIME STAMP
Other versions: 7.31 | 7.40 | 7.54
Syntax
GET TIME STAMP FIELD time_stamp.
Effect
This statement creates a
POSIX UTC time stamp from the
system time and
system date in AS ABAP and assigns it to the variable time_stamp
.
time_stamp
expects a variable of the data type TIMESTAMP
or TIMESTAMPL from ABAP Dictionary, in accordance with ABAP type
p with length 8 or p
with length 11, with seven decimal places. Depending on the data type, the time stamp is created either in the
short form or in the long form.
Note
The precision of the decimal places of the long form depends on the hardware (processor) of the application server. The maximum resolution of 100 ns is not always reached. On some platforms, only a resolution of milliseconds can be reached.
Example
Creates a time stamp. The time stamp must be formatted specially for the output, since a simple assignment would only produce a conversion from type p
to string
.
DATA: ts TYPE timestampl,
output TYPE string.
GET TIME STAMP FIELD ts.
output = |{ ts TIMESTAMP = ISO TIMEZONE = 'UTC ' }|.
WRITE / output.
Exceptions
Non-Catchable Exceptions
-
Cause: The target field differs from TIMESTAMP or TIMESTAMPL with regards to type, length, and decimal places.
Runtime Error:GET_TIMESTAMP_FORMAT