cancel
Showing results for 
Search instead for 
Did you mean: 

CAST doesn't work for DF34_DEC type

ShakulJugran
Advisor
Advisor

Hello,

I'm trying to cast a DF34_DEC type to CHAR or DECIMAL as the values appear in scientific notation for initial value (0E -12), but run into compile time errors.

Is this not supported yet? Please let me know if there is an alternate/better way.

Options used - CAST & fltp_to_dec()

Thanks!

Regards,

Shakul.

Accepted Solutions (0)

Answers (4)

Answers (4)

horst_keller
Product and Topic Expert
Product and Topic Expert
ShakulJugran
Advisor
Advisor
0 Kudos

Hello Horst,

strange, I'm not able to view your blog. Seems like it gets blocked by our SAP proxy here. Is it HTTPS or HTTP that you are using? Could you please re-post the link?

Regards,

Shakul.

ShakulJugran
Advisor
Advisor
0 Kudos

Hello Horst,

was finally able to get to your blog via a convoluted way through your posts 😉

Regards,

Shakul.

matt
Active Contributor

I've fixed the link.

ShakulJugran
Advisor
Advisor
0 Kudos

Thanks Matthew, I'm able to access it directly now.

ShakulJugran
Advisor
Advisor
0 Kudos

I pushed both casting operations through TO_DECIMAL( ) and SUM into a table function(AMDP) and it worked. Just in case someone wants to know a work-around for DECFLOAT types.

Regards,

Shakul.

Former Member
0 Kudos

Do the type have a conversion routine? If yes, can you use it to convert it to internal format? Afterwards it should be easy to convert the value to a decimal or string (characters), if still needed.

ShakulJugran
Advisor
Advisor
0 Kudos

Hello Armin,

I don't have a conversion routine on the data element, so when I use this as an underlying data type in my CDS View, the initial entries come up in scientific notation i.e. 0E -12.

Regards,

Shakul.

Sandra_Rossi
Active Contributor
0 Kudos

What is the use case of casting a decfloat34 to characters? But do you really mean ASSIGN df34 TO <c> CASTING? Or are you talking about explicit type conversion df34 to characters?

ShakulJugran
Advisor
Advisor

Hello Sandra,

like I have mentioned, the initial values for DF34_DEC come up as 0E -12 which is not user friendly on the UI. I have even tried to cast using the function FLTP_TO_DEC( ) to cast this to DECIMAL, but that doesn't seem to work either.

By casting I mean, using the keyword CAST in ABAP CDS or the CDS built-in function FLTP_TO_DEC( ).

Regards,

Shakul.