Skip to Content
avatar image
Former Member

How to replace u2018 changed u2018spaceu2019

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 03, 2008 at 02:40 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 02:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 02:43 AM

    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

    Add comment
    10|10000 characters needed characters exceeded