Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Dear community, I recently noticed the LASTCHANGEDATETIME field in the EKKO database table in a S/4HANA system. At the moment I'm not sure whether this field only exists in a S/4HANA because I didn't find it in a SAP ECC EHP8.

However, if the field stores exactly what the name implies, that would be great. The date and time a document was created or changed has always been an important information for me. In addition, my interest in this topic was piqued - please follow my little journey... 🙂

First steps

Ok, the starting point was the data element of the field. That's CHANGEDATETIME (domain TZNTSTMPL). As the documentation of the data element says: The field stores a time stamp.

Here is some help about time stamps in ABAP and a little example I've tried out. Please pay attention to the short form (data element TIMESTAMP) and long form (data element TIMESTAMPL) as described in the online help.
REPORT ztime_stamps.

DATA lv_short_time_stamp TYPE timestamp.
DATA lv_long_time_stamp TYPE timestampl.

GET TIME STAMP FIELD lv_short_time_stamp.
GET TIME STAMP FIELD lv_long_time_stamp.

DATA(lo_output) = cl_demo_output=>new( ).

lo_output->write( lv_short_time_stamp ).
lo_output->write( |{ lv_short_time_stamp timestamp = ISO timezone = sy-zonlo }| ).

lo_output->write( lv_long_time_stamp ).
lo_output->write( |{ lv_long_time_stamp timestamp = ISO timezone = sy-zonlo }| ).

lo_output->display( ).

The following screenshot shows the result.

example result

During my further search on the Internet for more information, I found this page. Very interesting. It contains several examples of how to deal with time stamps in ABAP. Especially calculating (see class CL_ABAP_TSTMP).

The story went on

The where-used list for the data element TIMESTAMPL (see example above) allowed me to find various database tables in which time stamps in long forms are used. Among other things, the TDEVC was listed. A look at this database table via transaction SE16 showed that not all entries have a time stamp. My Z-namespace development packages, for example, don't have one - for whatever reason?

The BW_SDATA package has a time stamp: 20.130.925.094.535,3021930 in the field TECH_CHG_TSTMP.

Formatting in Excel

My next question was about Excel and time stamps. Transaction SE16 is often used to export selected data records to Excel. If these data records contain time stamps, then one would certainly want to format them for better reading. Yep, even for a computer scientist, 20.130.925.094.535,3021930 is not nice to read 🙂

To my surprise, that was exported directly to match. No further formatting necessary. Great!

ready to read after export

Should there ever be a requirement to convert the time stamp in Excel, this can work as described below. The function "=TEXT(A1;"0000-00-00 00\:00\:00")+0" and some user defined cell format a la "TT/MM/JJJJ hh:mm:ss" (German Excel version) solved the problem when cell A1 contains the time stamp. Here's an example.

time stamp from A1 formatted in B1

Final question

The question remains whether the times of ERDAT/AEDAT and ERZET/AEZET fields are over now? Or long gone and I didn't notice? I know of many newer custom database tables that contain such fields and which are well suited for their purpose.

Should we now only use one time stamp for the creation date and time and another time stamp for the change date and time? And what does that mean for ABAP program logic and ABAP CDS (I've found this help page)?

What are your experiences? Please share. I'm curious. Thanks in advance.


Best regards, thanks fo reading and stay healthy