2007 Feb 22 6:21 AM
Hi,
I want to round decimal palces to normal value.
Ex: bsis-wrbtr ( 12.45) - i want to convert to 1245
133.00) - 13300.
Pls any one help.
Thanks,
Veeru
2007 Feb 22 6:24 AM
data : p_amt type p decimals 2,
v_amt(15)
p_amt = '133.00'.
v_amt = p_amt.
replace '.' with space in v_amt.
condense v_amt.
write : v_amt.
Hi,
I want to round decimal palces to normal value.
Ex: bsis-wrbtr ( 12.45) - i want to convert to 1245
133.00) - 13300.
Pls any one help.
Thanks,
Veeru
2007 Feb 22 6:24 AM
2007 Feb 22 6:24 AM
data : p_amt type p decimals 2,
v_amt(15)
p_amt = '133.00'.
v_amt = p_amt.
replace '.' with space in v_amt.
condense v_amt.
write : v_amt.
2007 Feb 22 6:34 AM
Hi Chandra,
i have tried this , iam not getting.
data : p_amt type p decimals 2,
v_amt(15).
p_amt = it_bsis-wrbtr.
v_amt = p_amt.
replace '.' with space in v_amt.
condense v_amt.
write : v_amt.
Thanks,
Veeru
2007 Feb 22 6:37 AM
data : p_amt type p decimals 2,
v_amt(15).
p_amt = it_bsis-wrbtr.
v_amt = p_amt.
search v_amt for '.'.
if sy-sbrc eq 0.
clear v_amt+sy-fdpos(1).
endif.
condense v_amt.
write : v_amt.
2007 Feb 22 6:40 AM
bsis-wrbtr ( 12.45) - i want to convert to 1245
133.00) - 13300
See the below modifications in ur code
This works fine.
DATA : p_amt TYPE p DECIMALS 2,
v_amt(15).
p_amt = '133.00'.
v_amt = p_amt.
REPLACE '.' WITH space<b>INTO</b> v_amt.
CONDENSE v_amt <b>NO-GAPS</b>.
WRITE : v_amt.Output is 13300.
If u want the output like
<b>13,300.00</b>
DATA : p_amt TYPE p DECIMALS 2,
v_amt(15).
p_amt = '133.00'.
v_amt = p_amt.
REPLACE '.' WITH space INTO v_amt.
CONDENSE v_amt NO-GAPS.<b>p_amt = v_amt.</b>
WRITE : p_amt.reward points and close the thread if ur problem got solved.
Reward pointsfor those who helped to solve this.
Message was edited by:
Judith Jessie Selvi
2007 Feb 22 6:52 AM
2007 Feb 22 6:30 AM
Hi,
USe keyword ... ROUND r with write statement as shown in following example:
Scaled output of a field of type P.
The decimal point is first moved r places to the left (r > 0)
or to the right (r < 0); this is the same as dividing with the
appropriate exponent 10**r. The value determined in this way is
output with the valid number of digits before and after the
decimal point. If the decimal point is moved to the left, the
number is rounded.
For further information about the interaction between the
formatting options CURRENCY and DECIMALS, see the notes below.
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.
Reward if helpful.
Regards,
Sipra
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |