Application Development and Automation 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: 
Read only

rounding up

Former Member
0 Likes
605

hi friends

is there any function module for rounding up the values.

how to use that .

how to align the numer field to right in alv.

thanks

sonu

6 REPLIES 6
Read only

Former Member
0 Likes
579

DATA: VAR1 TYPE P DECIMALS 2,

RES TYPE P DECIMALS 2.

VAR1 = '12.33'.

RES = ROUND( VAR1 ).

WRITE RES.

regards,

rewards point

Read only

Former Member
0 Likes
579

data: l_1 type i, l_2 type p decimals 2.

l_2 = '1.78'.

l_1 = FLOOR( l_2 ).

l_1 = l_1 + 1.

write: l_1.

Regards,

rewards point

Read only

Former Member
0 Likes
579

You can have two options :

1. Use CEIL function to get the result.

Go through this link for more details.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3316358411d1829f0000e829fbfe/content.htm

2. U can use ROUND_AMOUNT fm to get also.

REgards,

rewards point

Read only

Former Member
0 Likes
579

Here is the example Program

DATA pack TYPE p VALUE '123.456'

DECIMALS 3.

WRITE pack DECIMALS 2.

WRITE: / pack ROUND -2,

/ pack ROUND -1,

/ pack ROUND 1,

/ pack ROUND 2.

Result is

123,46

12.345,600

1.234,560

12,346

1,235

You need to use like

WRITE: / pack ROUND Your_field.

Regards

rewards point

Read only

Former Member
0 Likes
579

Hi,

write:/ value1 into value2 round decimal 2.

So this write not display but assign round value1 to value2.

Rewards points if it is useful.

Read only

Former Member
0 Likes
579

i got the solution.

thanks for reply.