SAP Knowledge Base Article - Public

2841389 - CDS Views are displaying date/time as UTC

Symptom

You want to have your Custom CDS View report in other time zone, but the system date/time is set to UTC.

You want to convert the Custom CDS View report time zone.

Environment

SAP S/4HANA Cloud Public Edition

Cause

This is expected bahavior. The reports based on CDS view they use default of today’s date which shows UTC date.

Resolution

The recommended solution is as follows:

1. Create a custom cube (via the “Custom CDS Views” App) which exposes fields of data type DATS/TIMS (which can be derived from a timestamp via the below mentioned functions).
    a.  Create calculated fields with functions:
       TSTMP_TO_DATS(tstmp,tzone,clnt,on_error)
       and TSTMP_TO_TIMS(tstmp,tzone,clnt,on_error)
       or DATS_TIMS_TO_TSTMP(date,time,tzone,clnt,on_error)b.

    b.  You can also create a calculated field with session variable("System Date") - Supported by Custom CDS View

2. Afterwards you can define a custom query based on this custom cube

Please note that the above functions are not supported by Custom CDS View but since calculated fields can also be created using the free editor, you might try to have these functions in your CDS view and see if they work.

See Also

List of Supported Functions

How to create a Calculated Field

SAP Community - How to convert a timestamp to date/time in CDS View?

Keywords

Custom CDS Views, calculated fields, timezone, timestamp, date, time, date/time, CDS view, UTC, convert timezone, time zone , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem

Product

SAP S/4HANA Cloud Public Edition all versions