07-03-2007 2:55 PM
Hi all
I am having one problem related to currency
DATA: lv_wavwr TYPE wavwr,
lv_price TYPE wavwr,
fkimg type MENG13
lv_price =.090
fkimg = 200.000
I am usung this statement for calculation.
lv_wavwr = lv_price * fkimg.
The result i am getting is 18000.000
It should be 180.
Could any body help?
07-03-2007 2:57 PM
goto the attributes of the program and check if <b>Fixed Point Arithmetic</b> checkbox is checked or not, if not checked check that
<b>Fixed point arithmetic</b>
If you mark this checkbox, all caluculations in the program will use
fixed point arithmetic.
If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC
or QUAN) will be treated as integers when they are used in assignments,
comparisons and calculations, irrespective of the number of decimal
places defined. Intermediate results in arithmetic calculations will
also be rounded to the next whole number. The number of decimal places
defined is only taken into account when you output the answer using the
WRITE statement.
Message was edited by:
Chandrasekhar Jagarlamudi
07-03-2007 3:22 PM
07-03-2007 3:38 PM
goto Se38
give the program name and press change button
in menu GOTO----->Attributes
at the botton u can see one checkbox <b>Fixed Point Arithmetic</b>
07-03-2007 3:41 PM
07-03-2007 2:57 PM
First
write: lv_prive to lv_price_temp units 'give the unit '.
then mutiply it will work
07-03-2007 2:59 PM
HI Vikram,
Write while outputting in the following way.
data : v_amount(17) type c.
WRITE lv_wavwr to v_amount Currency 'USD'.
write:/ v_amount.
Hope this will solve your problem.
Reward if help ful.
Instead of hardcoding, u can also write wa_bkpf-waers.
Thanks.
07-03-2007 3:04 PM
Hi
Dont refer data dictionary in Currency field. Instead declare it by using type P.
Like
Data:lv_wavrw type p decimals 3,
lv_price type p decimals 3,
fkimg type p decimals 3.
Then do the multiplication. It will work fine.
Reward me if its helpful.
Regards
Ravi
07-04-2007 5:50 AM