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 off

Former Member
0 Likes
737

hi to all,

help me in this issue

how to round off the amount of different currencies without using round_amount and fi_round_amount

thanks in advacne

kiran kumar

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
678

Hi,

You can handle it.

FM HR_IN_ROUND_AMT and HR_NZ_ROUNDING_DECIMALS

rgda

Anver

if hlped pls mark points

Read only

0 Likes
678

hi anersha,

in our system all the curencies r not maintained so there is a problem with funcitonal modules both fi_round_amount and round_amount.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
678

Hi,

Check FM ROUND..

Read only

Former Member
0 Likes
678

Have a look at below code.

Report ztest.

DATA pack LIKE vbap-netwr VALUE '123.456'.

WRITE pack DECIMALS 2.

WRITE: / pack ROUND -2,

/ pack ROUND -1,

/ pack ROUND 1,

/ pack ROUND 2.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

anversha_s
Active Contributor
0 Likes
678

Hi kiran,

then try this.

goto>attributes> check Fixed point arithmetic,

Fixed point arithmetic

If you mark this checkbox, all caluculations in the program will use fixed point arithmetic.

If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated as integers when they are used in assignments, comparisons and calculations, irrespective of the number of decimal places defined. Intermediate results in arithmetic calculations will also be rounded to the next whole number. The number of decimal places defined is only taken into account when you output the answer using the WRITE statement.

this will work

REPORT ZSPELL.

data : v_amt type p decimals 2 value '40.58',

v_int type i.

v_int = floor( v_amt ).

write : v_int.

regards,

Anver.

if hlped pls mark points

Read only

0 Likes
678

use as ur requerment for rounding..

check this example...

DATA: I TYPE I,

P TYPE P DECIMALS 2,

M TYPE F VALUE '-3.5',

D TYPE P DECIMALS 1.

P = ABS( M ). " 3,5

I = P. " 4 - business rounding

I = M. " -4

I = CEIL( P ). " 4 - next largest whole number

I = CEIL( M ). " -3

I = FLOOR( P ). " 3 - next smallest whole number

I = FLOOR( M ). " -4

I = TRUNC( P ). " 3 - integer part

I = TRUNC( M ). " -3

D = FRAC( P ). " 0.5 - decimal part

D = FRAC( M ). " -0.5