Symptom
You are using Custom CDS View application to create your own CDS View.
You have chosen a timestamp field from a standard Data Source and it looks like a decimal number.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
1. Create a Custom CDS View YY1_CUSTOMCDSVIEW
2. Make an association to I_ServiceEntrySheetAPI01 Service Entry Sheet API01 with alias _ServiceEntrySheet
3. Choose field _ServiceEntrySheet.ApprovalDateTime ApprovalDateTime Approval Date Field DEC (11)
4. When you preview the Custom CDS View, the DateTime field is represented as a number with decimals instead of a timestamp.
*The standard CDS View I_ServiceEntrySheetAPI01 is just an example that presents this issue.
Cause
The field comes in decimal format.
Resolution
In order to convert this data format, we recommend you to create calculated fields in Field Selection in Custom CDS Views.
With the following cast functions, it is possible to retrieve the data format as date:
cast( cast( DateTimeFieldName as ABAP.SSTRING( Length ) ) as ABAP.DATS )
cast( cast( floor(DateTimeFieldName ) as ABAP.SSTRING( Length ) ) as ABAP.DATS )
See Also
Keywords
Timestamp, Decimal format, DEC 21, Custom CDS View
, KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , BW-BEX-OT-ODP , Query Runtime for Operational Data Provisioning , MM-PUR-SVC-SES , Service Entry Sheet for Service Procurement , Problem