2007 Sep 12 11:27 AM
Hi,
I have a requirement to round off the values. The round offed values should store in another variable.
Can u give function module or any operator to achieve this one.
Ex v1 = 12.567.
round of v1 = v2 = 13.
Rewards as per answer.
2007 Sep 12 11:36 AM
data zval type p DECIMALS 3.
data zval1 TYPE p DECIMALS 0.
zval = '12.567'.
zval1 = zval.
WRITE / zval1.
Hi,
I have a requirement to round off the values. The round offed values should store in another variable.
Can u give function module or any operator to achieve this one.
Ex v1 = 12.567.
round of v1 = v2 = 13.
Rewards as per answer.
2007 Sep 12 11:36 AM
data zval type p DECIMALS 3.
data zval1 TYPE p DECIMALS 0.
zval = '12.567'.
zval1 = zval.
WRITE / zval1.
2007 Sep 12 11:36 AM
Hi,
Check,
DATA pack TYPE p VALUE '12.567'.
WRITE pack NO-GROUPING ROUND 0 DECIMALS 0.
reward point if useful.
2007 Sep 12 11:36 AM
Hi,
J_1I6_ROUND_TO_NEAREST_AMT
This FM rounds the number.
but the input shud b in ','.
for eg: input = 12,5 instead of 12.5
output= 13
Also, try this method:
data : a type p decimals 2,
b type i.
a = '10.20'.
b = abs( a ).
write : / b.
a = '10.50'.
b = abs( a ).
write : / b.
2007 Sep 12 11:36 AM
data:
w_pack_ip TYPE p decimals 3 VALUE '12.567',
w_pack_op TYPE p decimals 3.
w_pack_op = ceil( w_pack_ip ).
write: w_pack_op.
Alternatively u can also make use of the FM <b>'ROUND</b>'
2007 Sep 12 11:37 AM
Hi Kiran.
This is the way.
Data : v1 type p decimals 2 value '123.45',
v2 type p decimals 2.
write v1 to v2 decimals 0. "Value will be Rounded off automatically
WRITE:/ V2.
reward if Helpful.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |