cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Number conversion!

Former Member
0 Kudos

Hi all

I am reading data from a msSQL Database. One value is a decimal format 9(10,3)(means 10 digits in total (including the ',' ; 3 decimal afer the comma)

I am receiving for instance the value 567.200 from the DB.

To do an RFC to a SAP System I have to convert with FormatNum to 567,200

This works well when I am using ######.### and ',' in the FormatNum function of the mapping

Later on, I have to convert it back to write the value into a so call history table. If I am now using ######,### and '.' in the FormatNum function I am getting every time a java exception!!

If you suggest me to use an own java function please give me a concret code, because I am not a programmer. Only basics ;->

Regards Oliver

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

When you are sure, that the numbers of digits are correct, you can use the test function <i>replaceString</i> to replace the ',' with a '.'.

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos
     source
constant(,)- replaceString - target
constant(.)/
Former Member
0 Kudos

Hi Stefan

Thanks a lot. A short and easy solution. I just did not see the function as I looked for the solution. Four eyes are better ;->

Thanks and regards Oliver

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Oliver,

for the reconversion just remove the ","!

Regards Mario

Former Member
0 Kudos

what is the exception you are getting?

Can you paste the stack trace here?

stefan_grube
Active Contributor
0 Kudos

java.lang.NumberFormatException: For input string: "123,567"

An arithmetic function requires a Java conform number.

Regards

Stefan