Skip to Content

Replace '|' with Space

HI

I should replace ' | ' with space .

I am using 'Replacing all occurances ' but its not replacing with space .

please give inputs on this

thanks

kamesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 28, 2010 at 05:25 PM

    What does your code (and your string) look like? It helps when you post it...

    The statement works just fine for pipes and so does TRANSLATE...though the gaps will be handled differently.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I think this code works the same as the original.

      Regular expressions are another option. You can search the forum for examples.

      Rob

  • Oct 28, 2010 at 07:25 PM

    From help.sap.com:

    Character literals are sequences of alphanumeric characters in the source code of an ABAP program enclosed in single quotation marks or backquotes. Character literals enclosed in quotation marks have the predefined ABAP type c and are described as text field literals. Literals enclosed in backquotes have the ABAP type string and are described as string literals. The field length is defined by the number of characters. With text field literals trailing blanks are ignored while in string literals they are taken into account.

    So in your case you need to use string literal which is represented by backquotes `

    REPLACE ALL OCCURRENCES OF '|' IN lv_data WITH ` `.
    

    Now it will work

    Regards

    Marcin

    Add comment
    10|10000 characters needed characters exceeded