Application Development and Automation 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: 
Read only

replace ',' with '.'

Former Member
0 Likes
840

I want to replace this kind of things :

1234.89 with 1.234,89. -> it is needed the '.' too.

234.23 with 234,23.

Is there any FM known to do this? The idea is not only to replace '.' with ',' but to insert '.' in case it is needed.

Thank you.

7 REPLIES 7
Read only

Former Member
0 Likes
819

Hi,

Please change the settings of user profle.

<b>System > user profile > own data > defaults tab.

Chaneg teh decimal notation</b>

Change the format to the desired one.

This will automatically take care of the foramtting.

Else u have to use

<b>REPLACE '.' with ',' INTO string.</b>

Message was edited by:

Judith Jessie Selvi

Read only

Former Member
0 Likes
819

Maria,

You need to have definite logic how you want to include '.' or ','. If u can give the detail we can come to a solution.

regards,

paul

Read only

Former Member
0 Likes
819

Hi maria,

1. u can simply use WRITE number TO StrVar.

2. It will automatically write the number

1234.89 into the user format to StrVar.

regards,

amit m.

Read only

Former Member
0 Likes
819

Yup,

Go to 'Defaults' tab of the User Profile and change the Decimal notation radio button to the first one.

Read only

anilnal
Explorer
0 Likes
819

Hi,

Donot change the user profile options as the . and , setting are user dependent and vary.

For display - Use the WRITE statment to write the currency/quant fields to a CHAR17/18 variable - WRITE automatically takes care of the user settings.

Regards,

Anil.

Read only

Former Member
0 Likes
819

hi u have not specified that u r getting the problem while printing d value....

or where exactly u r griiong this this problem...ok

check these points.

1.Please change the settings of user profle.

System > user profile > own data > defaults tab.

Chaneg teh decimal notation (Change the format which u required)

This will automatically take care of the foramtting.

2. or u can use REPLACE '.' with ',' INTO string. ( u have to take the value into character variable or in string)

3.or if r printing write:/ variable CURRENCY variable related currency field.

Example

The output of the WRITE statement is "123456,78".

DATA int TYPE i VALUE 12345678.

WRITE int NO-GROUPING CURRENCY 'EUR'.

<b>write</b> XXXXX <b>to</b> YYYYYY... <b>CURRENCY</b> cur

This addition cannot be used together with the addition TIME ZONE.

Effect

This addition defines currency-dependent decimal places for the output of data objects of data types i or p. For all other data types, except for f, the addition is ignored. For cur, a three-digit, character-type field is expected that contains a currency key from the column CURRKEY of the database table TCURX in uppercase letters. The system determines the number of decimal places from the column CURRDEC of the respective row in the database table TCURX. If the content of cur is not found in TCURX, two decimal places are used. The following applies for numeric data types:

In the case of data types of type i, a decimal separator is inserted at the position determined by cur and the thousands separators are moved accordingly.

In the case of data objects of type p, the decimal places defined in the definition of the data type are ignored completely. Irrespective of the actual value and without rounding actions, the decimal separators and the thousand separators are inserted at the positions in the numbers determined by cur.

In the case of data objects of type f, the addition CURRENCY has the same effect as the addition DECIMALS (see below). Here, the number of decimal places is determined by cur.

If the addition CURRENCY with length specification * or ** is used after AT, it is used first and the output length is determined from the result.

Note

The addition CURRENCY is appropriate for the display of data objects of type i or p without decimal places, whose contents are currency amounts in the smallest unit of the currency.

Example

The output of the WRITE statement is "123456,78".

DATA int TYPE i VALUE 12345678.

WRITE int NO-GROUPING CURRENCY 'EUR'.

Ramesh

Read only

Former Member
0 Likes
819

just use the statement

write <number variable> to <string variable>.

The <string Variable> will have the desired result.

Thank you