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: 

How to replace u2018 changed u2018spaceu2019

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

Dear All

Thanks a lot.

solved.

if you have not point,please contace me.

Sun

Former Member
0 Kudos

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