Showing results for 
Search instead for 
Did you mean: 

YYYYMMDD to YYYY-MM-DD in Custom CDS-View App Cloud

0 Kudos


I want to compare an entered date from a business object I created with a date from the CDS-View field "I_MaterialStockTimeSeries.EndDate" as an expression based filter.

_YY1_X.DatumVerschiebung =_I_MaterialStockTimeSeries( P_StartDate: 20230501, P_EndDate: 20230601, P_PeriodType: 'D' ).EndDate

When I try to do this, I get the following error:

Both fields have the DATS(8) data type.

However, the field "DatumVerschiebung" is displayed in the preview as YYYYMMDD.

The field "EndDate" as YYYY-MM-DD.

I wrote these attempts to match the data type to each other:

cast( substring( cast( _I_MaterialStockTimeSeries( P_StartDate: 20230501, P_EndDate: 20230601, P_PeriodType: 'D' ).EndDate as abap.char(10) ), 1, 8 ) as abap.dats)


cast( _I_MaterialStockTimeSeries( P_StartDate: 20230501,

P_EndDate: 20230531, P_PeriodType: 'D' ).EndDate as ABAP.DATS )

It always comes up with the same error: "Datatypes DATS and DATS are compatible, but their lengths 000008 and 000010 differ"

I have now tried to convert the "DatumVerschiebung" field to YYYY-MM-DD, however I have not found a solution that works in the "Calculation" function.

I only found information on how to do it in the ADT tools, but not in the Custom CDS Views app without ADT.

thank you in advance!


Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos


Try to convert end date in char datype and see

cast (EndDate as abap.char(10)) as edate

Thank you