on 2023 May 17 9:20 AM
Hello,
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!
Lukas
Hi,
Try to convert end date in char datype and see
cast (EndDate as abap.char(10)) as edate
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.