Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal Places Issue

Former Member
0 Kudos

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' ?

11 REPLIES 11

Former Member
0 Kudos

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

0 Kudos

Hi Shashikanth,

i have already tried that with decimal places as 10. there is a problem with type P that it is packed decimal and it stores in 8 bytes so it supports only 16 field length. where as here as of now i am using a domain which i created with data type FLTP 16 length 16 decimal places. this is working too but vaues are like this : 8.5000000000000000E+04

now i have tried to round it off with all the FM's i have found on SCN but nothing works.

so what to do.

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

matt
Active Contributor
0 Kudos

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?

vinodkumar_thangavel
Participant
0 Kudos

Hi ,

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

Regards,

Vinod.

0 Kudos

what is the syntax?

0 Kudos

Check the below syntax,


Data value TYPE curr DECIMALS 8.

Regards,

Vinodkumar.

Former Member
0 Kudos

Hi Aishwarya,

Try declaring as fallows.

data value type decfloat16.

It should work it will

Regards,

Shashikanth

ipravir
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Aishwarya,

If you need more bytes than try with decfloat34 datatype.

Regards,

Shashikanth

Former Member
0 Kudos

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

Former Member
0 Kudos

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.