cancel
Showing results for 
Search instead for 
Did you mean: 

How to Convert DEC(21,7) to DATS(8)?

lukasgw7
Explorer
0 Kudos

Hello community,

I am trying to convert the data type DEC(21,7) from a field "created DateTime" to a date type DATS(8).

I want to do this in the Custom CDS View Fiori-app.

I have already tried several functions in the Calculation-editor (ABAP), but unfortunately I did not get the result I want.

Is there a function that makes the conversion to DATS(8) possible?

thank you!

Greetings,

Lukas

raymond_giuseppi
Active Contributor
0 Kudos
lukasgw7
Explorer
0 Kudos

Datatype: DEC (21,7)

"... TSTMPL_TO_UTCL(tstmpl,on_error,on_initial)" works, but unfortunately it does not bring me to my desired data type. Also from UTCL I have not found a solution to convert to DATS(8).

View Entire Topic

Hi Lukas,

There is no direct function available to convert an element of type DEC(21,7) to DATS(8).

You can but try to use the following combination:

cast( substring( cast( tstmpl_element as abap.char(27) ), 1, 8 ) as abap.dats) as tstmpl_dats

Regards,
Harish

lukasgw7
Explorer
0 Kudos

Perfect!

Thank you. I had found solutions that gave me the same combination of numbers, but not the right type.

Great, thanks for the help!

Regards,

Lukas