Get Example source ABAP code based on a different SAP table
VERSION 5 IN • CL_ABAP_TSTMP ABAP_CLASS
System Class for Time Stamps in Packed Numbers The class CL_ABAP_TSTMP>> is used to calculate and convert time stamps in packed numbers>. Important methods include:
The methods ADD>, SUBTRACTSECS>, ADD_TO_SHORT>, and SUBTRACTSECS_TO_SHORT> add or subtract seconds from time stamps and avoid invalid values.
The method TD_SUBTRACT> calculates the difference between two time stamps.
The method MOVE_TO_SHORT> converts the long form of time stamps to the short form, avoiding invalid values.
The method MOVE> converts the long form of time stamps to the short form and vice versa, avoiding invalid values.
The method NORMALIZE> normalizes time stamps. Invalid time stamps are converted into valid time stamps.
The methods UTCLONG2TSTMP>, UTCLONG2TSTMP_SHORT>, and TSTMP2UTCLONG> convert the content of time stamp fields to representation in packed numbers and vice versa.
Latest notes:
Conversions between time stamp fields and packed numbers are necessary if time stamp fields are used in new programs, but existing repositories or interfaces need to be accessed at the same time.
The methods MOVE>, MOVE_TO_SHORT>, ADD_TO_SHORT> and SUBTRACTSECS_TO_SHORT> can be used for converting long time stamps to short time stamps. These methods avoid invalid values but round the fractional seconds of long time stamps commercially. That might be unexpected. In order to preserve the integer part of a long time stamp it must be rounded down. See also executable example Rounding Time Stamps in Packed Numbers >. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Creation of a one hour earlier time stamp by subtracting 3600 seconds. ABEXA 00867 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 Conversion of a time stamp field to time stamps in packed numbers. In formatting using string templates, the formatting option TIMESTAMP>> must be specified for the packed numbers to define a representation as time stamps. ABEXA 00868 ABAP_EXAMPLE_END