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

round decimal

Former Member
0 Likes
860

i have the number type p decimals 2

I want that when tnat for 2 I make a commercial rounding.

es. 1,99 ---> 2 .

there is an istraction.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
820

hi

try to use

'CEIL'(Smallest integer value ) 'FLOOR'(Largest integer value) and 'TRUNC'(Integer part of argument )

like

data: t1 type p decimals 2 value '1.99',

t2 type i..

t2 = ceil(t1).

t2 = floor(t1).....

try this link - http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3316358411d1829f0000e829fbfe/frameset.htm

Edited by: mayank jain on Jun 4, 2009 11:43 AM

Edited by: mayank jain on Jun 4, 2009 11:47 AM

Edited by: mayank jain on Jun 4, 2009 11:53 AM

i have the number type p decimals 2

I want that when tnat for 2 I make a commercial rounding.

es. 1,99 ---> 2 .

there is an istraction.

5 REPLIES 5
Read only

Former Member
0 Likes
820

Hi

Please try ROUND_UP for rounding to next integer and ROUND_DOWN to round to previous integer.

Regards

Gaurav.

Read only

former_member222860
Active Contributor
0 Likes
820

Use CEIL() function

data: f1 type p decimals 2 value '1.99'.

f1 = ceil( f1 ).

write:/ f1.

Pl. search , you'll find lot of threads on this

Read only

Former Member
0 Likes
821

hi

try to use

'CEIL'(Smallest integer value ) 'FLOOR'(Largest integer value) and 'TRUNC'(Integer part of argument )

like

data: t1 type p decimals 2 value '1.99',

t2 type i..

t2 = ceil(t1).

t2 = floor(t1).....

try this link - http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3316358411d1829f0000e829fbfe/frameset.htm

Edited by: mayank jain on Jun 4, 2009 11:43 AM

Edited by: mayank jain on Jun 4, 2009 11:47 AM

Edited by: mayank jain on Jun 4, 2009 11:53 AM

Read only

Former Member
0 Likes
820
DATA : INT TYPE I,
       DEC TYPE P Decimals 2.
DEC = '1.99'.
INT = DEC.
WRITE:/ DEC,INT.
DEC = '1.49'.
INT = DEC.
WRITE:/ DEC, INT.
Read only

Former Member
0 Likes
820

DATA: I TYPE P,
      J TYPE P.
I = '12.712324'.
WRITE: / I ROUND 0 DECIMALS 4.
J = '12.336216'.
WRITE: / j ROUND 0 DECIMALS 4.