SAP GET TIME-STAMP ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID GET-TIME-STAMP
• GET TIME STAMP ABAP Statement
• FIELD GET TIME STAMP

GET TIME STAMP
Short Reference

ABAP_SYNTAX
GET TIME STAMP FIELD time_stamp.

What does it do?
This statement uses the system time and system date of the AS ABAP to create a UTC time stamp according to the POSIX standard and assigns it to the variable time_stamp of type p as a time stamp in a packed number.
The following can be specified for time_stamp:
An existing variable of the data type TIMESTAMP or TIMESTAMPL from the ABAP Dictionary, in accordance with the ABAP type p with length 8 or p with length 11 and seven decimal places. Depending on the data type, the time stamp is created either in the short form or in the long form.
An inline declaration DATA(var) or FINAL(var), where a variable of type TIMESTAMP is declared.



Latest notes:

The precision of the decimal places of the generated time stamp depends on the hardware (processor) of the host computer of the current ABAP_ASINSTANCE . Resolutions in the one-digit or two-digit microsecond range are realistic.
A time stamp in its short form is the integer part of a time stamp in its long form. In order to create the respective short form from an existing long form time stamp, the value of the long form must be rounded down. This cannot be achieved by a simple assignment because the corresponding p to p conversion rule rounds commercially. Instead, an appropriate function such as round or trunc can be used. Note that the methods MOVE_TO_SHORT and MOVE of the system class CL_ABAP_TSTMP prevent invalid results but also round commercially. See the executable example Rounding Time Stamps in Packed Numbers.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Creation of two time stamps. An existing variable of the type TIMESTAMPL must be used for the long form. An inline declaration can be used for the short form. The time stamps must be formatted specially for the output, since otherwise only numbers of type p would be displayed.
ABEXA 00309
ABAP_EXAMPLE_END



Runtime Exceptions


Non-catchable Exceptions
Reason for error:
The target field differs from TIMESTAMP or TIMESTAMPL with respect to type, length, and decimal places.
Runtime error:
GET_TIMESTAMP_FORMAT
ABAP_NONCAT_END

Return to menu