on 04-03-2008 9:36 AM
hi gurus
My requirement is round off a decimal value
in such a fashion that
if is 12.7767898 then convert to 12.50
again if it is 12.498989 convert to 12.50.
please help
Thanks in advance
Use this function..
J_1I6_ROUND_TO_NEAREST_AMT
I think it will serve u..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this does not works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could do something like this:
DATA: number(16) TYPE P DECIMALS 4.
whole_part(16) TYPE C,
remainder(4) TYPE C,
value(20) TYPE C.
MOVE number TO value.
SPLIT value AT ',' INTO whole_part remainder.
Then, examine the remainder:
IF remainder(1) GE '5'.
remainder = '5000'.
ELSE.
* do something else
ENDIF.
CONCATENATE whole_part ',' remainder INTO value.
In your data display method, display this character string (value) instead of the numerical value (number).
This is a bit unfortunate because you have to type cast your value to string, but it works well enough. Just make sure you don't have any arithmetical operations on this newly created data field because you will get an exception.
Also, please note that this is not the complete solution, but only to give you an idea.
Regards,
SD
WRITE pack ROUND 2 DECIMALS 4.
FM - CATSXC_ROUND_QUANTITY
FIMA_NUMERICAL_VALUE_ROUND
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hai
there is fm 'ROUND' ..APPLY THIS FUNCTION MODULE.
IF U WANT TO GET FOLLOWING.
FOR THIS 12.06666..IF U WANT TO GET ONLY 12.
USE 'CEIL(12.066666)'
FOR THIS 12.789 ,,IF U WANT TO GET ONLY 13.
USE ''FLOOR(12.789) ..SEE THIS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.