SAP BUILTIN TYPES DATE TIME



Get Example source ABAP code based on a different SAP table
  


• t ABAP_TYPE
• d ABAP_TYPE
• utclong ABAP_TYPE

Built-In Date Types, Time Types, and Time Stamp Types
The data objects of the date types, time types, and time stamp types are used to store calendar dates, times, and time stamps.

Attributes TypeLengthStandard LengthMeaning Data Object ABAP_KEY d8 characters Date type Date field ABAP_KEY t6 characters Time type Time field ABAP_KEY utclong8 byte Time stamp type Time stamp field

Value Ranges and Initial Values TypeValue RangeInitial Value dAny eight Unicode characters that can be encoded in UCS-2; valid values are only digits that are valid as dates in accordance with the calendar rules in the format yyyymmdd: yyyy (year): 0001 to 9999, mm (month): 01 to 12, dd (day): 01 to 31 00000000 tAny six Unicode characters that can be encoded in UCS-2; valid values are only digits that are valid as times in accordance with the 24-hour clock range in the format hhmmss. hh (hours): 00 to 23, mm (minutes): 00 to 59, ss (seconds): 00 to 59.000000 utclongInternal 8-byte integer representation of a UTC time stamp exact to 100 nanoseconds, in ISO-8601 notation between 0001-01-01T00:00:00.0000000 and 9999-12-31T23:59:59.9999999. There are 3,155,380,704,000,000,000 real values and one special initial value.0



Latest notes:

Date types and time types d and t
The date types and time types are used to handle calendar date and time values. For more information on how to use them and their special handling, see Date Fields and Time Fields .
From a technical perspective, the data types d and t are flat character-like types. The content of their data objects is stored according to the current system code page.
As character-like data types, data objects of the data types d and t can be used like text fields of the type c. This applies in particular to structures with components of the types d and t.
The generic type clike also includes the types d and t.
Data objects of the types d and t behave like character-like objects in character-like operand positions and numeric in numeric operand positions.
The data types d and t are the built-in ABAP types that correspond to the special types DATS , DATN, and TIMS, TIMN of the ABAP Dictionary.
The valid values of the data types d and t are a subset of their value range. ABAP statements that work with data objects of these types are only guaranteed to function correctly for operands with valid values.
Time stamp type utclong
The time stamp type utclong represented internally by integer numbers replaces the time stamps represented by packed numbers as the type for real time stamp fields.
The data type utclong is the built-in ABAP type that corresponds to the special type UTCLONG in ABAP Dictionary.
The system class CL_ABAP_UTCLONG for time stamps in time stamp fields contains the minimum and maximum values of the type utclong as attributes.
Invalid values in time stamps, that is integer numbers outside of the string of valid values, can be created using casting.
There is no time stamp for the days missing due to the switch from the Julian to the Gregorian calendar. The time stamp 1582-10-04T23:59:59.9999999 is followed by the time stamp 1582-10-15T00:00:00.0000000.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Declaration of date fields and time fields of the built-in ABAP types d and t and examples for their use. The declarations are made with the statement DATA and using the declaration operator DATA.
ABEXA 00839
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5
Creation of a time stamp of the type utclong with the built-in function utclong_current and its conversion to date and time fields.
ABEXA 00840
ABAP_EXAMPLE_END