Skip to Content
avatar image
Former Member

Decimal Places Issue

Hi,

i am trying to multiply

Value =  EBAN-PREIS * TEMP_CURR * EBAN-MENGE.

where TEMP_CURR is  TEMP_CURR TYPE UKURS_CURR

and i am getting a value into it from  Z_READ_EXCHANGE_RATE.

so what happens is:

value = 14.32 * 60.12345 * 10.123

how to declare Variable 'VALUE' ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Jan 05, 2015 at 07:27 AM

    Hi Aishwarya,

    If you need more bytes than try with decfloat34 datatype.

    Regards,

    Shashikanth

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05, 2015 at 07:58 AM

    Hi Aishwarya ;

    You can use 'DECFLOAT34' ; i tried with your values and its working , like below ;

    data : v1 type eban-preis  VALUE '14.32' ,

              v2 type UKURS_CURR  VALUE '60.12345' ,

              v3 type eban-menge  VALUE '10.123' ,

              value type DECFLOAT34.

      value = v1 * v2 * v3 .

      write value .


    Best Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05, 2015 at 06:36 AM

    Hi Aishwarya,

    you can declare VALUE as fallows

    Data value type p decimals 8.

    The number after DECIMALS keyword specifies number of decimals you can mention that according to your requirement.

    Regards,

    Shashikanth

    Add comment
    10|10000 characters needed characters exceeded

    • Aishwarya Nautiyal wrote:

      Data value type p decimals 8 this doesn't work. thanks for helping me out.😊

      Hmm. Which part of "The number after DECIMALS keyword specifies number of decimals you can mention that according to your requirement." did you not understand?

  • avatar image
    Former Member
    Jan 05, 2015 at 06:47 AM

    Hi ,

    Try to declare the variable with type CURR and the number of decimal places u need.

    Regards,

    Vinod.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05, 2015 at 07:22 AM

    Hi Aishwarya,

    Try declaring as fallows.

    data value type decfloat16.

    It should work it will

    Regards,

    Shashikanth

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2015 at 07:27 AM

    Hi Aishwarya,

    it's depends on your final output requirement, that how used wants to see the final output.

    Kindly check with user first and based on that declare the value Data Type.

    It could be P Decimal 2, or P Decimal2 or P Decimal 3.

    Since , you are multiplying the all above kind of data types.

    Regards.

    Praveer.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05, 2015 at 07:36 AM

    Hii Aishwarya

    Just define value type char

    e.g value(30.

    and after calculation just write condense value


    Hope this will be helpful

    Regards

    Gaurav

    Add comment
    10|10000 characters needed characters exceeded