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

REgarding converting ',' TO '.'

Former Member
0 Likes
2,119

HI EXPERTS,

i m working on simple alv,,,using erfmg field of mseg table,in database table the value is entered in this format 5,000,but this comma is basically a decimal i.e ' . ' what i want is that instead of 5,000 the 5.000 sud come in the output list....for this what sud i do...

plz help me.

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
1,071

hi,

chk this.


*1,234,567.89  => 1.234.567,89.

data: l_amnt(100) type c.

l_amnt = '1.234.567,89'.

replace all occurrences of ',' in l_amnt with '#'.

replace all occurrences of '.' in l_amnt with ','.

replace all occurrences of '#' in l_amnt with '.'.

write : l_amnt.

Rgds

Anversha

8 REPLIES 8
Read only

anversha_s
Active Contributor
0 Likes
1,073

hi,

chk this.


*1,234,567.89  => 1.234.567,89.

data: l_amnt(100) type c.

l_amnt = '1.234.567,89'.

replace all occurrences of ',' in l_amnt with '#'.

replace all occurrences of '.' in l_amnt with ','.

replace all occurrences of '#' in l_amnt with '.'.

write : l_amnt.

Rgds

Anversha

Read only

Former Member
0 Likes
1,071

Hi..

<b>Replace all occurances of ',' in w_value with '.'.</b>

Read only

Former Member
0 Likes
1,071

first move this integer type variable into a character type and now u can use..

TRANSLATE or REPLACE..

<b>data w_value(20) type c.

w_value = mseg-amount.

translate w_value using ',.'.

or

replace all occurrences of ',' in w_value with '.'.</b>

<b>Heay this ',' to '.' conversion depends on the user master settings for your user id. if it is , only then no need of this change !! take care of that also..</b>

regards,

sai ramesh

Read only

Former Member
0 Likes
1,071

Hi,

For this you have to change user settings or else u can replace ',' with '.'.

<b>Replace all occurences of ',' in <var name> with '.'</b>.

Regards,

Read only

Former Member
0 Likes
1,071

Hi..

data menge type ekpo-menge.

Use

Replace all occurrences of <b> ','</b> in menge with <b>'.'</b>.

Regards

Bala..

Read only

Former Member
0 Likes
1,071

Hi Ravi,

Check this info

THIS PROCEDURE IS BY CHANGING SETTINGS :

In your user profile, change the decimal format you are currently using.

System->User Profile->Own data.

Go to defaults tab and then change your decimal notation.

THIS PROCEDURE IS WITHOUT CHANGING DEFAULT SETTINGS:

Check this sample code.

Report YH642_TEST.

TABLES:

mard.

DATA : W_mard_labst type p decimals 3,

w_dt1(18).

data:

W_N TYPE I.

SELECT SINGLE * FROM MARD INTO MARD WHERE LABST = '10000.00'.

WRITE: mard-labst .

W_mard_labst = mard-labst.

WRITE:/ W_mard_labst .

w_dt1 = w_mard_labst .

write W_mard_labst to w_dt1.

W_N = STRLEN( W_DT1 ).

W_N = W_N - 4.

OR , Try this way.

REPLACE ALL OCCURRENCES OF ',' IN W_DT1 WITH '.' .

REPLACE ALL OCCURRENCES OF '.'

IN SECTION OFFSET W_N LENGTH 4 OF W_DT1 WITH ','.

WRITE: / W_DT1.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Read only

Sougata
Active Contributor
0 Likes
1,071

Also check the decimal notation settings in the user profile...if its set to , system will output 500,00.

Hope this helps.

Read only

Former Member
0 Likes
1,071

if u want to display in required manner , goto system->userprofile->owndata->defaults

in this so many representions are there. select required format and save the profile. no need to write any in the program.