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

replacing ',' with space

former_member575017
Participant
0 Likes
838

Hi Experts,

I need to replace ',' with space in one field.

I am using following syntax but its not working help me

REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.

REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.

Both are not working, so need ur help.

Thanks

Basu

8 REPLIES 8
Read only

Former Member
0 Likes
814

Hope you loop the itab to make this change .

Loop itab.

REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.

---> You need to use modify itab to make the change permanent

endloop.

Read only

JozsefSzikszai
Active Contributor
0 Likes
814

try using TRANSLATE:

TRANSLATE itab-xyz USING ', '. "pls. not there is a space after the coma

also check if itab-xyz has any value when the statement is reached

Read only

Former Member
0 Likes
814

data: output type string.

create an itab of type text.

split <string> at ',' into table <itab>.

loop at itab.

concatenate output <itab-field> into output separated by space.

endloop.

- Hemant

Read only

Former Member
0 Likes
814

>

> REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.

> REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.

>

You have to use IN TABLE itab instead of IN itab-xyz.

REPLACE ALL OCCURRENCES OF ',' IN TABLE itab WITH SPACE.

Regards

Karthik D

Edited by: Karthik D on Nov 5, 2008 3:07 PM

Read only

Former Member
0 Likes
814

Hi,

I have recently worked with the same syntax. It is working fine for me. Please check this out.

LOOP AT t_itab ASSIGNING <fs_t_itab>.

CHECK <fs_t_itab> IS ASSIGNED.

REPLACE ALL OCCURRENCES OF ',' IN <fs_t_itab>-fieldname WITH ''.

ENDLOOP.

Read only

former_member575017
Participant
0 Likes
814

Thanks all for your efforts.

I am using below code its working fine

while itab-xyz cs ','.

replace ',' with ' ' into itab-xyz.

endwhile.

Thanks

Basu

Read only

0 Likes
814

close the thread as answered if you got the solution.

Regards

Karthik D

Read only

Former Member
0 Likes
814

Hello,

As far as my knowledge is concern, i don't think that the code has any nagation..

REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.

REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.