cancel
Showing results for 
Search instead for 
Did you mean: 

I want to convert decimal value into round figure

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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.

former_member181995
Active Contributor
0 Kudos

use ROUND FM

and pass 'X' in sign parameter.

Hope this would help.

Amit.

former_member195698
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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