2008 Jan 12 10:47 AM
i would like the syntax to truncate numbers to 2 decimal places. eg
(456/700) *100 will give me 65.142857142857142857
thanks
2008 Jan 12 10:52 AM
Hi,
data:res type p decimals 2
res = (456/700) *100
store the result in res varaible
Rewards If Useful
Regards
Hi,
data:res type p decimals 2
res = (456/700) *100
store the result in res varaible
Rewards If Useful
Regards
2008 Jan 12 10:52 AM
Hi,
data:res type p decimals 2
res = (456/700) *100
store the result in res varaible
Rewards If Useful
Regards
2008 Jan 12 10:55 AM
Try this :
DATA: cal(9) TYPE p DECIMALS 2.
cal = ( 456 / 700 ) * 100.
2008 Jan 12 11:02 AM
Hi,
Create a packed variable with 2 decimals and pass the result to this variable, it will be automatically truncated to 2 decimals.
DATA: v_res(8) TYPE p DECIMALS 2.
v_res = (456/700) *100 .
Rewards points if helpful.
Regards,
Srinivas Ch
2008 Jan 12 11:59 AM
Hi Tendai,
check this code..
DATA: num1 TYPE f, num2 TYPE p DECIMALS 2.
num1 = '1.666666'.
num2 = num1.
WRITE num2.
Reward points if helpful..
Regards,
Goutham.
2008 Jan 12 12:07 PM
Hi Tendai,
Declare a varibale to type P with decimals 2.
DATA : result TYPE p DECIMALS 2.
Now store the result of your expression in the variable declared above.
result = (456/700) *100.
Now out the result you will find the result in your desired format.
WRITE : / result.
Reward if useful.
Regards,
Chandru
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |