Skip to Content
-1

Char to Int conversion is not working in Abap CDS View

Hi Team,

Char to Integer conversion is not working in ABAP CDS View.

capture.png

I also tried converting Char to Numc and then Numc to integer. But still no luck.

Any thoughts on this?

Regards,

Shawon

capture.png (2.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • What is the type of your "StartTime" field and what values does it contain? And what is the error message you get. Please share that instead of just sharing a "restricted" screenshot which says a little bit more than nothing.

  • Hi Florian,

    StartTime is of type Tims. I need to get a time difference between EndTime and StartTime. So I tried to convert both the StartTime and EndTime to integer and then get the time difference.

    Suppose StartTime is 200020 and EndTime is 201020. Then the difference will be 20 minute. I need to get the difference either in minute/second/hour.

    Regards,

    Shawon

  • Get RSS Feed

3 Answers

  • May 17 at 01:13 PM

    Hello Shawon,

    As per the SAP Guidelines only below conversions are allowed:

    https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_cast_expression.htm

    As you are trying to cast the time datatype field to int directly it is not working. Type to cast it to char or SSTRING and then to int

    Add comment
    10|10000 characters needed characters exceeded

  • May 18 at 06:22 AM
    -1

    Hi Amit,

    As per the attached screenshot, SSTRING to Integer conversion is also not possible. The same is true for CHAR.

    Can you please have a look ?

    Regards,

    Shawon

    Add comment
    10|10000 characters needed characters exceeded

  • May 17 at 01:39 PM
    -2

    Hi,

    As direct conversion from char to int conversion may not possible. you try with, first convert CHAR to string and then STRING to INT it will work.

    Add comment
    10|10000 characters needed characters exceeded