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 which comes under category Arithmetic.

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 =

I tried "round"

Can anybody tell me the

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use the function formatNumber and set that as 000.00 after calling the divide function.

This will work.

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

Thanks a for your reply.

I have given here is just an example and that is not the fixed format of output.

The function should be able to handle any output.

Please let me know if you have any other approach.

Thanks a lot.

Harry

Former Member
0 Kudos

Did you test your mapping with formatNumber? you can change it as .00 and check your output, only the digits after the decimal point will get rounded.

Answers (3)

Answers (3)

Former Member
0 Kudos

refer this for how to use a standard function in a UDF

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414800)ID1890496350DB11671542375625193736End...

creat a UDF with 2 argument a and b


import com.sap.aii.mappingtool.flib3.Arithm;
Arithm ar = new Arithm();
return ar.div(a,b,container);

Former Member
0 Kudos

Hi,

Sorry the same solution is already given by Ravi.

Regards,

Sarvesh

Edited by: Sarvesh Singh on Sep 24, 2009 7:18 PM

former_member187339
Active Contributor
0 Kudos

Hi,

Did you tried googling!!!

BTW check these http://www.roseindia.net/java/beginners/RoundTwoDecimalPlaces.shtml

Regards

Suraj