Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Round off the decimal value

Former Member
0 Kudos

hi,

I need decimal value round off to upper limit

input is 15.67 the output should be 16.

Regards,

deepthi.

1 ACCEPTED SOLUTION

former_member705122
Active Contributor
0 Kudos
DATA :
wa_test(10) TYPE p DECIMALS 2.
wa_test = '15.67'.
wa_test = CEIL( wa_test ).

DATA :
wa_test1(10) TYPE p DECIMALS 2.
wa_test1 = '15.67'.
wa_test1 = FLOOR( wa_test1 ).

WRITE: wa_test , wa_test1.
7 REPLIES 7

former_member705122
Active Contributor
0 Kudos

Use FM

ROUND

0 Kudos

hi,

the outp of FM round is

15.7 for input 15.68

my req is for input 15.68 , output is 16.

Regards,

Deepthi.

0 Kudos

hi,

use these operators.

CEIL

Smallest integer value that is not less than x

FLOOR

Largest integer value that is not greater than x

Former Member
0 Kudos

hii

Fm

ROUND

CO_R0_FLOAT_ROUND_RESULT

you can use following code

data : wa_val type p decimals 2,
           wa_ans type i.

           
         wa_val = '32.22'.
         wa_ans = abs( wa_val ).
         write : / wa_ans.
         wa_val = ceil ( wa_val ).
         write:/ wa_val.

regards

twinkal

Former Member
0 Kudos

Round fm will do it

former_member705122
Active Contributor
0 Kudos
DATA :
wa_test(10) TYPE p DECIMALS 2.
wa_test = '15.67'.
wa_test = CEIL( wa_test ).

DATA :
wa_test1(10) TYPE p DECIMALS 2.
wa_test1 = '15.67'.
wa_test1 = FLOOR( wa_test1 ).

WRITE: wa_test , wa_test1.

Former Member
0 Kudos

Use this code

DATA pack TYPE p VALUE '15.67'.

WRITE pack NO-GROUPING DECIMALS 0.

This will help

Regards,

Prashant