EM OData DateTime Time Zone
We are using the EM OData service to retrieve event handlers for freight orders out of SAP TM. That works fine. However, the format of the event date/time values are not clear to me.
I reported some events for a freight order directly through the TM Transportation Cockpit. My time zone there is set to CET. What confuses me right now, are the resulting values in OData (/FreightOrderEventHandlerDetails):
suggests the event was reported at 13:12:00 CET, as a trailing Z indicates the UTC time zone. But in fact it was not. The correct time is 14:12:00 CET, which is exactly what I entered in the Transportation Cockpit. But there is also the EventTimeZone field:
So maybe the service doesn’t care about the Z pattern at all, if a separate time zone field is provided.
Because then again, there is also this – correctly – added to every entry:
That’s the time I saved my changes in Transportation Cockpit.
So what should I do to use the times provided via OData in a UI5 app and display the values according to the user's local time zone? Check if there is a separate time zone field and manually convert the date/time value, according to a custom time zone table, as the path /TimeZones does only return time zone names but not the offset?
Am I missing a EM (or possibly TM) setting?
Daniel Haerder replied
Steffen is right. The misleading Z is automatically added by Gateway and can unfortunately not be avoided. You have to ignore it - the timestamp refers always to the time zone that comes with it.
In the EM backend customizing you have to ensure that the configured fields that represent a timestamp have the semantics 'Timestamp' and that a second configured field is assigned as 'Configured Field for Timezone'. This field has to have the semantics 'Timezone'.
For the most important timestamps used in EM there are already standard configured fields available:
- Expected Date/Time: EXP_DATE_TS and EXP_TIMEZONE
- Actual Date/Time: REP_DATE_TS and REP_TIMEZONE
- Reporting Date/Time: MSG_DATE_TS and MSG_DATE_TZ
You only have to add the configured that refers to the (local) timestamp into your display profile. A property for the time zone will be generated automatically in the related entity of the EM OData service.
Of course, the timestamp provided by the OData service reflects only correct date/time/timezone if the configured field with semantics 'Timestamp' refers to a local timestamp field and the configured field with semantics 'Timezone' to the corresponding time zone field.
Best regards, Daniel