SAP CHAR DATE TIME FIELDS ACCESS

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Accessing Character-Like Date Fields and Time Fields
Only a few operand positions are affected by the fact that character-like date fields and time fields contain a local date in the format 'yyyymmdd' or a local time in the format 'hhmmss':
When using character-like date fields and time fields as source fields or target fields of a lossless assignment.
When converting a local date and a local time to a time stamp using CONVERT INTO TIME STAMP and back again using CONVERT TIME STAMP .
In output formatting using string templates or the statement WRITE [TO]
When mapping to asXML or JSON.
In all other operand positions, the handling of character-like date fields and time fields is specified in the conversion rules and comparison rules for these data types.
The conversion rules are designed so that data objects of the types d and t display character-like behavior in character-like operand positions and numeric behavior in numeric operand positions. In the latter case, the content of a character-like date field is converted to the number of days since 01.01.0001 and the content of a characte r-like time field is converted to the number of seconds since midnight.
The comparison rules are designed so that a later date or later time is greater than an earlier date or earlier time.
Direct assignments or comparisons between the data types d and t are meaningless and therefore forbidden. The following sections show examples of how to access character-like date fields and time fields effectively.
Character-Like Access to Character-Like Date Fields and Time Fields
Accessing Character-Like Date Fields and Time Fields Numerically

Note
The function modules of the function group SCAL provide some additional information about character-like dates, for example the day of the week or the calendar week for a given date.