Application Development 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: 

REPLACE ALL OCCURRENCES OF....

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Else try TRANSLATE keyword.

5 REPLIES 5

Former Member
0 Kudos

Hi,

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

Regards

Stu

Former Member
0 Kudos

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

Else try TRANSLATE keyword.

0 Kudos

Thanks Swastik.

Former Member
0 Kudos

hi

loop at itab into wa.

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

endloop.

Former Member
0 Kudos

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