SAP CHAR DATE TIME FIELDS NUMLIKE



Get Example source ABAP code based on a different SAP table
  



Numeric Access to Date Fields and Time Fields
Numeric access to date fields and time fields exploits the fact that the conversion of the types d and t to numeric values produces an integer number of days or seconds. This applies particularly when using date fields and time fields in numeric calculations, where they are converted to the corresponding calculation type. This enables differences to be calculated or values to be added or subtracted from date fields or time fields. All other arithmetic operations are generally not useful here. To avoid unexpected results from such calculations, the validity of the content of the date or time fields must be ensured.

ABAP_EXAMPLE_VX5
The following calculations provide the current day of the year as well as the hour, minutes, and seconds of the current time. The date and time are provided by a time stamp.
ABEXA 00852
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5
The following calculation provides the day of the week for a date field date containing any valid date. 1 means Monday, 2 means Tuesday, and so on.
ABEXA 01701
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5
The following calculations provides the last day of the previous month.
ABEXA 01700
ABAP_EXAMPLE_END