Application Development 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: 

Plz give me FM for "ROUND" example: 55.65 = 56 and 55.15 = 55

Former Member
0 Kudos

hi all,

I am trying to round of somes balances to without decimal places.

1) my value is 55.12

I need the value should be 55

or

1) my value is 55.65

i need the value should be 56

if the value is >.5 it should be 1

if the value is <.5 it should be 0

Please let me know how to do this

I tried some ROUND FM's...But, I can't get.

Plz Give me exact FUNCTION MODULE

Thanks in advance.

RAM

4 REPLIES 4

Former Member
0 Kudos

Try this

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.

Also check this out -

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.

ashish

Message was edited by:

Ashish Gundawar

former_member208856
Active Contributor
0 Kudos

Hi Ram

take the help from this code :

DATA : v_var1 TYPE p DECIMALS 3 VALUE '55.56',

v_var2 TYPE i.

v_var2 = CEIL( v_var1 ).

WRITE : v_var2.

<b>Reward points, if helpful,</b>

Regards,

Sandeep kaushik

Former Member
0 Kudos

hi,

Pass that value on to a integer variable ..


ie., data : i_int type i.


 i_int = 55.56.

write i_int.

Regards,

Santosh

Former Member
0 Kudos

Hi,

Declare a variable with type integer and pass the decimal value to it.

Thanks,

Sriram Ponna.

Message was edited by:

Sriram Ponna