‎2007 Jun 01 4:37 PM
Hi Experts,
I have declared my internal table with variables using like bsak-dmbtr as below :
data : begin of itab occurs 0,
salpb like bsak-dmbtr,
solbm like bsak-dmbtr,
salhb like bsak-dmbtr,
end of itab.
Now While using SUM, the values in internal table gets rounded off .
I want to <b>avoid</b> rounding the numbers and display the amoutn as it is
i.e 9,712.97 should be shown as 9,712.97 and not 9712 or 9713.
The problem is the same when i declare the variables of <b>type p decimals 2</b>.
Could anyone please suggest me a solution.
Thanks
Dan
‎2007 Jun 01 5:27 PM
HI
Instead of refering Data dictionary, try to delcare the field with type p decimals 2.
Ex
data : begin of itab occurs 0,
salpb type p decimals 2,
solbm type p decimals 2,
salhb type p decimals 2,
end of itab
and then find the sume for this field.
i hope this will solve ur problem
Need ur reward points.
Regards
Ravi
‎2007 Jun 01 4:44 PM
Hi
Check the attribute of your report, perhaps you've not checked the flag "Fixed Point Arthimetic"
Max
‎2007 Jun 01 4:48 PM
Hi Dan,
I am not sure if this problem is related to the SUM keyword or the program attributes.
Please check your program attributes and make sure the attribute (checkbox) "Fixed Point Arithmetic" is checked. If this is not checked, all your calculations will be rounded.
Hope this helps,
Sumant.
‎2007 Jun 01 4:49 PM
Hi,
If you dont have Fixed point arithmetic turned on , the rounding will happen
Kindly reward points if helpful.
Regards,
gaurav
‎2007 Jun 01 4:50 PM
Hi Dan,
Declare a variable of type DMBTR and inside the loop add the value to the decalred variable. This time after the loop the value will not bo rounded of. Means the value will come upto 2 decimal places.
e.g.:
DATA: v type DMBTR.
Loop at itab.
v = v + bsak-dmbtr.
endloop.
Ashvender
‎2007 Jun 01 5:17 PM
Hi All,
Yes the fixed point airthemtic box id checked. I am on version 4.0.
But still not solved.
Ashvender Kumar - can u elaborate that?
DATA: v type DMBTR.
should be DATA: v like bsak-DMBTR..Isn't it?
thanks
‎2007 Jun 01 5:40 PM
Odd - would you try running this? It works as expected with fixed point arithmetic on or off:
REPORT ztemp LINE-SIZE 80 MESSAGE-ID 00.
DATA: bseg_int TYPE TABLE OF bseg WITH HEADER LINE.
SELECT * FROM bseg
INTO TABLE bseg_int UP TO 10 ROWS.
LOOP AT bseg_int.
WRITE /001 bseg_int-dmbtr.
AT LAST.
SUM.
WRITE /001 bseg_int-dmbtr.
ENDAT.
ENDLOOP.
Rob
‎2007 Jun 01 5:27 PM
HI
Instead of refering Data dictionary, try to delcare the field with type p decimals 2.
Ex
data : begin of itab occurs 0,
salpb type p decimals 2,
solbm type p decimals 2,
salhb type p decimals 2,
end of itab
and then find the sume for this field.
i hope this will solve ur problem
Need ur reward points.
Regards
Ravi