cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for standard "Divide" function

Former Member
0 Kudos

Hello All,

In my scenario,I have to use standard divide function.

For example : If i divide the value 1525.71 by 3.000 It should give output as 508.57

but with divide function its giving output as 508.56998.

2) 520.00/3.000 = 173.3333

I tried "round" function but its not giving proper output in certain cases.

I am expecting output should be 2 decimals rounded.

Can anybody tell me the way to get it or Any UDF.

Thanks a lot.

Harry

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Reddy,

The blog given by sunil has an example of round function. This exactly should solve your issue. Create the same udf function.

Regards,

---Satish

sunilchandra007
Active Contributor
0 Kudos

Hi Harry,

Just have a look at this blog.

Never, ever use XI's built-in arithmetic functions

/people/thorsten.nordholmsbirk/blog/2006/04/03/never-ever-use-xis-built-in-arithmetic-functions

Hope it would solve your issue !!!

Regards,

Sunil Chandra

former_member182004
Contributor
0 Kudos

Hey,

What you have to do is: after getting the result of the Divide function, you have to take that as an input for the FormatNumber function (also included in the Arithmetic group), and that will transform your number with 2 decimals. Using also the standard value that it has: Number Format: ###,###,###.## and Decimal Separator: <empty>

Regards,

Juan

Former Member
0 Kudos

Hi Harry,

Please refer SAP Note: 958486.

This should solve the issue.

Also consider creating a UDF and use BigDecimal.

Regards,

Anish