Symptom
Unable to expose data using GET with Custom CDS as External API.
- Error message: In the context of Data Services an unknown internal server error occured. 500 internal server error
Environment
S/4HANA Cloud
Cause
In the CDS View, there's a calculated field DateTime coming in decimal format. It seems that you are working with long timestamps and using "cast( cast( DateTimeFieldName as ABAP.SSTRING( Length ) ) as ABAP.DATS )".
Resolution
You have to cut off the decimals in the long timestamp. In this case, please use "cast( cast( floor(DateTimeFieldName) as ABAP.SSTRING( Length ) ) as ABAP.DATS )".
Keywords
expose data, get method, Custom CDS, External API, In the context of Data Services an unknown internal server error occured, 500 internal server error, calculated field, datetime, timestamp, decimal, cast, ABAP.SSTRING, ABAP.SSTRING( Length ), ABAP.DATS , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem