2005 Dec 09 1:35 PM
Hi,
I am calculating this formula
w_tax_amt = ( v_tot * konp-kbetr ) / 100
Following are the values
v_tot = 329284.57
konp-kbetr = 5.00
This yields w_tax_amt = 16464.23
I am expecting this value to be 16464.22 as using calci it comes 16464.2284
I dont want rounding to happen. How should I go about it ?
What type should I use. Currently all the tyes are of bseg-wrbtr type
Thanks
2005 Dec 09 1:42 PM
Please try this. Using FLOOR will always round down.
REPORT ZRICH_0002 .
data: v_tot type p decimals 2.
data: konp-kbetr type konp-kbetr.
data: w_tax_amt type p decimals 2.
v_tot = '329284.57' .
konp-kbetr = '5.00' .
<b>w_tax_amt = ( floor( v_tot * konp-kbetr ) ) / 100.</b>
write:/ w_tax_amt.
Welcome to SDN.
Please make sure to award points for helpful answers and mark your posts as solved when solved completely. Thanks.
Regards,
Rich Heilman
Hi,
I am calculating this formula
w_tax_amt = ( v_tot * konp-kbetr ) / 100
Following are the values
v_tot = 329284.57
konp-kbetr = 5.00
This yields w_tax_amt = 16464.23
I am expecting this value to be 16464.22 as using calci it comes 16464.2284
I dont want rounding to happen. How should I go about it ?
What type should I use. Currently all the tyes are of bseg-wrbtr type
Thanks
2005 Dec 09 1:39 PM
In the editor see the setting for fixed point arithmetic.
Go to attributes in se38 and see if the check box for fixed point arithmetic is checked or not.
Regards,
Vamsi.
2005 Dec 09 1:39 PM
Declare the variable w_tax_amt with 3 or 4 decimals and then use the truncate function.
2005 Dec 09 1:41 PM
Hi,
You should use 'DECIMALS' OR 'ROUND' depending on what you need.
Effect of different DECIMALS specifications:
DATA: X TYPE P DECIMALS 3 VALUE '1.267',
Y TYPE F VALUE '125.456E2'.
WRITE: /X DECIMALS 0, "output: 1
/X DECIMALS 2, "output: 1.27
/X DECIMALS 5, "output: 1.26700
/Y DECIMALS 1, "output: 1.3E+04
/Y DECIMALS 5, "output: 1.25456E+04
/Y DECIMALS 20. "output: 1.25456000000000E+04
Effect of different ROUND specifications:
DATA: X TYPE P DECIMALS 2 VALUE '12493.97'.
WRITE: /X ROUND -2, "output: 1,249,397.00
/X ROUND 0, "output: 12,493.97
/X ROUND 2, "output: 124.94
/X ROUND 5, "output: 0.12
Hope this helps, please dont forget to reward if this was helpful,
Gabriel P,
2005 Dec 09 1:42 PM
Please try this. Using FLOOR will always round down.
REPORT ZRICH_0002 .
data: v_tot type p decimals 2.
data: konp-kbetr type konp-kbetr.
data: w_tax_amt type p decimals 2.
v_tot = '329284.57' .
konp-kbetr = '5.00' .
<b>w_tax_amt = ( floor( v_tot * konp-kbetr ) ) / 100.</b>
write:/ w_tax_amt.
Welcome to SDN.
Please make sure to award points for helpful answers and mark your posts as solved when solved completely. Thanks.
Regards,
Rich Heilman
2005 Dec 09 1:57 PM
Hi Nitin!
Something of topic: tax is not calculate on line level, but on header level and afterwards distributed. There can be rounding differences based on the different procedures - just in case you will compare with standard documents.
Regards,
Christian
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |