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 Amounts

Former Member
0 Likes
608

Hi All,

If decimal part is between 00 and 49, the integer part remains unchanged

(e.g.: 125,49 becomes 125)

If decimal part is greater than 49, the integer part is rounded up

(e.g. 125,50 becomes 126)

How to implement technically in program and Is there is any function for this,

Plz help me with samle code or Guidence

Award points for helpful answers

Thanks

SEK

4 REPLIES 4
Read only

Former Member
0 Likes
582

Hi raja,

1. simple

2. just copy paste

3.

report abc.

data : p1 type p decimals 2.

data : num type i.

p1 = '125.50'.

<b>CALL FUNCTION 'ROUND'</b>

EXPORTING

  • DECIMALS = 0

INPUT = p1

  • SIGN = '+'

IMPORTING

OUTPUT = num

EXCEPTIONS

INPUT_INVALID = 1

OVERFLOW = 2

TYPE_INVALID = 3

OTHERS = 4

.

write num.

regards,

amit m.

Read only

Former Member
0 Likes
582

Hi..

Just move it to <b>type Integer</b>.

<b>data:</b>

w_1 type p decimals 2,

w_int type i.

w_1 = '125.49'.

w_int = w_1.

<b>write: w_int.</b>

w_1 = '125.59'.

w_int = w_1.

<b>write: / w_int.</b>

Message was edited by:

Rammohan Nagam

Read only

former_member673464
Active Contributor
0 Likes
582

hi..

move the field to integer.

see this

data :

w_pack type p decimals 2 value '12.50',

w_int type i.

move w_pack to w_int.

write w_int.

regards,

veeresh

Read only

Former Member
0 Likes
582

hi,

Use <b>ROUND</b> FM ..

Regards,

Santosh