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 ALL OCCURRENCES OF....

Former Member
0 Likes
3,352

In my internal table I want to replace the SPACES by a character '%20'.

I am using

REPLACE ALL OCCURENCES OF ' ' IN TABLE GT_TAB WITH '%20'.

But I am getting an exception CX_SY_REPLACE_INFINITE_LOOP.

Let me know if there is any way to replace all the SPACE in an internal table.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,689

Loop at internal table into work area and then use REPLACE ALL for that work area.

Else try TRANSLATE keyword.

In my internal table I want to replace the SPACES by a character '%20'.

I am using

REPLACE ALL OCCURENCES OF ' ' IN TABLE GT_TAB WITH '%20'.

But I am getting an exception CX_SY_REPLACE_INFINITE_LOOP.

Let me know if there is any way to replace all the SPACE in an internal table.

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
1,689

Hi,

Loop thru the table and do the replace on each line...

Regards

Stu

Read only

Former Member
0 Likes
1,690

Loop at internal table into work area and then use REPLACE ALL for that work area.

Else try TRANSLATE keyword.

Read only

0 Likes
1,689

Thanks Swastik.

Read only

Former Member
0 Likes
1,689

hi

loop at itab into wa.

replace all accurances of ' ' in wa-<field> with '%20'.

endloop.

Read only

Former Member
0 Likes
1,689

Hi,

Use the REGEX addition of REPLACE as follows;

REPLACE ALL OCCURRENCES OF REGEX '\s' IN TABLE itab with '%20'.

But remember to remove any trailing spaces in the string and be sure that your string can hold the result as you are replacing a single space with three characters '%20'.

Regards

Karthik D