01-05-2015 6:27 AM
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' ?
01-05-2015 6: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
01-05-2015 6:44 AM
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.
01-05-2015 10:04 AM
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?
01-05-2015 6:47 AM
Hi ,
Try to declare the variable with type CURR and the number of decimal places u need.
Regards,
Vinod.
01-05-2015 7:02 AM
01-05-2015 7:09 AM
Check the below syntax,
Data value TYPE curr DECIMALS 8.
Regards,
Vinodkumar.
01-05-2015 7:22 AM
Hi Aishwarya,
Try declaring as fallows.
data value type decfloat16.
It should work it will
Regards,
Shashikanth
01-05-2015 7: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.
01-05-2015 7:27 AM
Hi Aishwarya,
If you need more bytes than try with decfloat34 datatype.
Regards,
Shashikanth
01-05-2015 7: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
01-05-2015 7: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.