2010 Feb 22 2:07 AM
Dear Freinds,
i have an amount as 121.539 , now whenf i divided by 10 it is becoming rounding to 12.154 automatically. This is not acceptable during the testing they have said it has to 12.153 only .
The data type of amount is 3 decimals type. Could any one let me know how can i stop rounding and get exactly as 12.153 only
instead of 12.154.
regards
ravi
2010 Feb 22 2:44 AM
Hi Ravi,
<li>Try this way.
Thanks
Venkat.OREPORT ztest_notepad.
DATA:value1 TYPE p DECIMALS 3 VALUE '121.539'.
DATA:value2 TYPE c LENGTH 20.
DATA:len TYPE i.
value2 = value1 / 10.
CONDENSE value2.
len = STRLEN( value2 ).
len = len - 5.
value2+len(5) = value2+len(4).
WRITE value2.
2010 Feb 22 2:44 AM
Hi Ravi,
<li>Try this way.
Thanks
Venkat.OREPORT ztest_notepad.
DATA:value1 TYPE p DECIMALS 3 VALUE '121.539'.
DATA:value2 TYPE c LENGTH 20.
DATA:len TYPE i.
value2 = value1 / 10.
CONDENSE value2.
len = STRLEN( value2 ).
len = len - 5.
value2+len(5) = value2+len(4).
WRITE value2.
2010 Feb 22 2:57 AM
Dear Venkat,
Thanks allot it surved the purpose of problem, but i have one question can you explain me what exactly 5 means in the logic
len = len - 5.
i.e why you have taken 5 and specific reason.
this is only point i dint understood.
regard
madhu
2010 Feb 22 3:11 AM
Hi Madhu, <li> 4 decimal places and decimal point. After dividing, you will get 4 decimal places right. Thanks, Venkat.O
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |