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

How to replace u2018 changed u2018spaceu2019

Former Member
0 Likes
748

Dear All

I have a problem in replaced character u2018 with u2018 u2018.

for example: STR1 is 'ABC'EFGHI' ,

I want changed 'ABC EFGHI'

How can I do

Thanks

Sun

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
694

Hi

check the following code

text-001 : ABC'DEF

text-002 : '

DATA:
  str(7) TYPE c,
  sub(1) TYPE c,
  new(1) TYPE c.

START-OF-SELECTION.
  str = text-001.
  sub = text-002.
  new = ' '.
  WRITE / str.

  REPLACE sub WITH new INTO str.
  WRITE / str.

4 REPLIES 4
Read only

Former Member
0 Likes
694

Check below sample code:

DATA: l_text TYPE char10 VALUE 'ABC''EFGHI',
      l_apos TYPE char01 VALUE ''''.

WRITE:/ l_text.

REPLACE l_apos IN l_text WITH space.

WRITE:/ l_text.

Kind Regards

Eswar

Read only

Former Member
0 Likes
695

Hi

check the following code

text-001 : ABC'DEF

text-002 : '

DATA:
  str(7) TYPE c,
  sub(1) TYPE c,
  new(1) TYPE c.

START-OF-SELECTION.
  str = text-001.
  sub = text-002.
  new = ' '.
  WRITE / str.

  REPLACE sub WITH new INTO str.
  WRITE / str.

Read only

0 Likes
694

Dear All

Thanks a lot.

solved.

if you have not point,please contace me.

Sun

Read only

Former Member
0 Likes
694

Just checked the help of REPLACE and it seems the trailing spaces in search text the searching text are ignored. So the output will be in condensed form as per your current search.

Check below example ignoring the above:

DATA: l_text TYPE char10 VALUE 'ABC''EFGHI',
      l_apos TYPE char01 VALUE ''''.

WRITE:/ l_text.

SEARCH l_text FOR l_apos.
l_text+sy-fdpos(1) = space.

WRITE:/ l_text.

Kind Regards

Eswar