Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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):

<d:EventDateTime>2015-10-28T14:12:00Z</d:EventDateTime>


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:

<d:EventTimeZone>CET</d:EventTimeZone>


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:

<updated>2015-10-28T13:13:11Z</updated>


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?

  • SAPK-92003INSCEMSRV
  • SAPK-74012INSAPGWFND

Regards,

Jan

Former Member
replied

Hi Jan,

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

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question