cancel
Showing results for 
Search instead for 
Did you mean: 

Custom CDS View convert Decimal Field to Date

former_member306668
Participant

Hi;

I like to determine the period when a project has been created or last updated. For this I like to first convert the CreatedDateTime field which is a decimal to a Date Field so I can link it to the FiscalYear view.

I tried cast( I_EngProj.CreationDateTime as ABAP.DATS ) but I am getting the error "CAST CREATIONDATETIME of type DEC to type DATS is not possible".

Does anyone know how this can be achieved?

Thanks

Thomas

View Entire Topic
former_member306668
Participant

Found the solution. First cast the field to a string, and then cast it to a date.

AlwinPut
Active Participant
0 Kudos

When converting FLTP to DEC to DATE, via STRING I got the message:
"STRING is not supported as target type at CAST." (ABAP version 75H)
This can be fixed by using abap.char.

FLTP to DEC

FLTP_TO_DEC( FltpValueas abap.dec(8,0) ) as FltpValueDec,

FLTP to DATS (via DEC and CHAR) (So: DEC -> CHAR -> DATE)

cast( cast( FLTP_TO_DEC( FltpValue as abap.dec(8,0) ) as abap.char( 10 ) ) as abap.dats) as FltpValueDate,