cancel
Showing results for 
Search instead for 
Did you mean: 

decimal to comma and vice-versa

Former Member
0 Kudos

Hi,

I want to change the comma in the number format to decimal (for decimals' place) and also the thousands' separator should be a comma.

For eg: 3.267,3 should be converted to 3,267.3

Can i use a standard function(which one?, how?) or a user-defined java function(if so, plz give the code)?

Please help.

Thanks,

John

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi,

>

> I want to change the comma in the number format to decimal (for decimals' place) and also the thousands' separator should be a comma.

>

> For eg: 3.267,3 should be converted to 3,267.3

>

> Can i use a standard function(which one?, how?) or a user-defined java function(if so, plz give the code)?

>

> Please help.

>

> Thanks,

> John

a.replaceAll(".","~");
a.replaceAll(",","@");
a.replaceAll("~",",");
a.replaceAll("@",".");
return a;

a simple approach ...

you can also play around with indexOf and do the exact conversion

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can use replaceString function from Text category.

Mapping:

InputValue(3.267,3) -->
Constant(.) -->             replaceString -->             
Constant(-) -->                                               replaceString -->
                                   Constant(,) -->                                        replaceString --> OutPut
                                   Constant(.) -->                      Constant(-) -->
                                                                        Constant(,) -->

-Rohit

sunilchandra007
Active Contributor
0 Kudos

Hi,

It can be simply done with a standard function replaceString

replaceString(Source, Constant(","), Constant("$"))

replaceString(Source, Constant("."), Constant(","))

replaceString(Source, Constant("$"), Constant("."))

for help refer to

http://help.sap.com/saphelp_nw04/helpdata/en/4c/b2ad3de2d76b3be10000000a114084/frameset.htm

Regards,

chandra