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

How can display Rounded Values

Former Member
0 Likes
444

Hi Expert,

Here i displayed age in decimals. But i want round figure. like if it is 0.5 or 0.6 it is rounded as 1 and if it is 1.4 rounded as 1.5 like that.

How can i wil do

Thanks

2 REPLIES 2
Read only

Former Member
0 Likes
405

If your requirement is to round to the nearest integer, declare a variable of type Integer and move the decimal value to integer variable. This will get you the rounded integer value. You can try with below example code:

PARAMETERS: p_dec TYPE netwr.

DATA: p_num TYPE i.

p_num = p_dec.

write:/ p_num.

Read only

0 Likes
405

Hi,

Try this code....

code

report zrich_0001 .

data: c(20) type c,

p1(10) type p decimals 1,

p2(10) type p decimals 2.

c = '22354.22'.

p1 = c.

p2 = p1.

Write 😕 p2.

[/code]

There is a ABAP statement ROUND.

Check this link for details and examples.

http://help.sap.com/erp2005_ehp_03/helpdata/EN/9f/db9e3d35c111d1829f0000e829fbfe/frameset.htm

Regards,

Raj.