on 06-04-2008 12:50 PM
Hi ,
I want to convert decimal value into round figure.
Eg - 2.3 it will print 2 which is round figure.
if it is 2.6 it will print 3 which is round figure.
Please help me out.
Regards,
Anindita
Hi ,
Use the function module ROUND.
This function module rounds the value INPUT to ANDEC decimal places. The
parameter SIGN determines whether rounding is down ('-'), up ('+') or
commercial ('X').
If SIGN = SPACE, there is no rounding (OUTPUT = INPUT).
Example
The value VALUE is to be rounded up to the nearest hundred.
DATA: VALUE TYPE F,
ROUND_VALUE TYPE F.
..
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 2-
INPUT = VALUE
SIGN = '+'
IMPORTING
OUTPUT = ROUND_VALUE
EXCEPTIONS
INPUT_INVALD = 01
OVERFLOW = 02
TYPE_INVALID = 03.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use ROUND FM
and pass 'X' in sign parameter.
Hope this would help.
Amit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can use arithmetic functions for that...
check the functions
FLOOR(a)
CEIL(a)
FLOAT(a,s)
http://www.sapdb.org/7.4/htmhelp/02/12af08b51411d2a97100a0c9449261/content.htm
Regards,
aj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In scripts
If variable has value var = 15.3333125 then
&var(.3)& prints as 15.333
So if u dont want decimals,then write:
var(x)
where x is max length allowed, which you can see in its data element
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if you want to round the value of netwr to 2 decimals you can use.
&netwr(15)&
this means it will restrict the field to 15 digits with no decimals.
Thanks,
NN.
Edited by: Nethaji babu on Jun 4, 2008 2:03 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.