Skip to Content

CAST doesn't work for DF34_DEC type

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 09, 2016 at 04:08 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 09, 2016 at 09:00 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • avatar image
    Former Member
    Nov 09, 2016 at 10:23 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Nov 17, 2016 at 06:14 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded