The SAP internal date format is a commonly used sortable format, yyyymmdd. Sort it and the oldest date will show up as first value. Handy and convenient, unless it is the most recent date you would want to show first. A dateĀ field can also be stored as an inverted date.
In HR payroll the T569U table is an example of inverted date-use. Instead of 25.07.2016 the table contains (see SE16) 74.92.7983. To transform your own date into an inverted date:
data: lv_mydate type d, lv_mydate_inverted type d. lv_mydate = sy-datum. convert date lv_mydate into inverted-date lv_mydate_inverted.
To reverse this process, simply perform the CONVER DATE
again - in reverse:
data: lv_mydate type d, lv_mydate_inverted type d. lv_mydate = sy-datum. convert inverted-date lv_mydate_inverted
into date lv_mydate.
The same setup applies to time, which is - much to my surprise - done the exact same way the date is converted:
data: lv_mytime type t, lv_mytime_inverted type t. lv_mytime = sy-uzeit. convert date lv_mytime into inverted-date lv_mytime_inverted.
Would you like to learn my source on this example: I noticed that for table T569U
a view is available which allows SM31
access to V_T569U
. If the table with inverted dates is viewed through SM31
, the dates and times are displayed "normal", where as SE16/SE16n
output is displayed as inverted. Conversion from database values to what is displayed is done in module CONVERT_DATA
(in include L0PX2O08
).