08-22-2017 10:54 AM
When creating new DB tables in ERP, I want to add also columns to carry the time stamps for creation and last change.
SAP standard tables normally use a DATE and TIME field for that (ERDAT/ERZET). But since the DATE is relative to the time zone, I tend to using a TIMESTAMP field. What do you think? Do you use TIMESTAMP or DATE/TIME fields for this purpose?
08-22-2017 12:32 PM
With my techie hat on I agree timestamp is more accurate and has certain benefits. But from a usability perspective I find them a pain to work with. How often do you want to find stuff that happened in a date range vs stuff that happened during a specific time interval? With dates you have the calendar dropdown in SE16 to tell you that the first week of this month was 20170807000000 - 20170813235959. So, give me date and time please.
Using sy-datum is universal and time-zone independent as it is the system date. So I would always use date and time, and if I have a specific need for a timestamp, I add this as an extra field. SAP seems to follow this, the only tables only with timestamps are low-level techie tables. Not many users are going to poke around ARFCSSTATE 🙂
08-22-2017 12:32 PM
With my techie hat on I agree timestamp is more accurate and has certain benefits. But from a usability perspective I find them a pain to work with. How often do you want to find stuff that happened in a date range vs stuff that happened during a specific time interval? With dates you have the calendar dropdown in SE16 to tell you that the first week of this month was 20170807000000 - 20170813235959. So, give me date and time please.
Using sy-datum is universal and time-zone independent as it is the system date. So I would always use date and time, and if I have a specific need for a timestamp, I add this as an extra field. SAP seems to follow this, the only tables only with timestamps are low-level techie tables. Not many users are going to poke around ARFCSSTATE 🙂
08-22-2017 3:42 PM
Hello,
I agree with Mike. I always use SY-DATUM and SY-UZEIT for DB entries and if I need a timestamp or a local Time display I use classes like that :
https://wiki.scn.sap.com/wiki/display/ABAP/Basic+date+calculations+using+class+-+CL_RECA_DATE
08-31-2018 10:23 AM
For this purpose I'd use DATE/TIME. At least, it seems more logical to me. Actually, i was using this for DB table and by far it's been working fine. You should use DATA/TIME.