<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: String manipulation - REPLACE ALL OCCURRENCES in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600271#M867091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: text TYPE string.

text = 'Blag$is$an$ABAP$Consultant'.

WHILE sy-subrc EQ 0.
  REPLACE '$' WITH space
  INTO text.
ENDWHILE.

WRITE:/ text.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Mar 2008 17:11:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-27T17:11:22Z</dc:date>
    <item>
      <title>String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600269#M867089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;We are using R/3 4.6C and for some reason, the command REPLACE ALL OCCURRENCES OF... is not recognised by the compiler. Is it because the this was introduced from the later versions?&lt;/P&gt;&lt;P&gt;If so can you please suggest an alternative to remove any special characters from a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:08:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600269#M867089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600270#M867090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi , i think this is working...check it..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:char(25) value '5#4#2#&amp;amp;1#&amp;amp;',&lt;/P&gt;&lt;P&gt;     char1(9) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       replace all occurrences of '#' in char with 'and' .&lt;/P&gt;&lt;P&gt;       replace all occurrences of '&amp;amp;' in char with 'num' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     write: char.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:09:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600270#M867090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600271#M867091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: text TYPE string.

text = 'Blag$is$an$ABAP$Consultant'.

WHILE sy-subrc EQ 0.
  REPLACE '$' WITH space
  INTO text.
ENDWHILE.

WRITE:/ text.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:11:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600271#M867091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600272#M867092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; in the below string # is replaced by space&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  YCHATEST                                .

DATA : V_STRING TYPE STRING.

V_STRING = 'avvvvvv#kjkjkjdfk#jkjklsf#'.

TRANSLATE V_STRING USING '#  '.

CONDENSE V_STRING no-gaps.

WRITE : V_STRING. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:11:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600272#M867092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600273#M867093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try and use the 'old' REPLACE statement. Look for exact syntax at help.&lt;/P&gt;&lt;P&gt;You might be right that this statement is not yet valid for you release, but the 'old' REPLACE will also do the trick, but in that case you will have to do it in a DO-ENDDO loop since you can't replace them all at once like the ALL OCCURENCES variant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:13:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600273#M867093</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-03-27T17:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600274#M867094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Thank yoy for your replies.&lt;/P&gt;&lt;P&gt;All occurences is still not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying out the other solutions as well.&lt;/P&gt;&lt;P&gt;Can you also please let me know how I can replace ' (single quote)?&lt;/P&gt;&lt;P&gt;How do I specify this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:26:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600274#M867094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600275#M867095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: TEXT TYPE STRING.

TEXT = 'Blag''is''an''ABAP''Consultant'.

while sy-subrc eq 0.
replace '''' with space
into text.
endwhile.

write:/ text.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:28:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600275#M867095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600276#M867096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe not the most efficient, but it seems to do what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zz_temp.

DATA: g_v_string(80)          TYPE c VALUE '123!@#abcDEF$%^456$%^xyz',
      g_v_printable_chars(62) TYPE c,
      g_v_alpha(52)           TYPE c VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuzwxyz',
      g_v_integers(10)        TYPE c VALUE '0123456789',
      g_v_len                 TYPE i.

CONCATENATE  g_v_alpha g_v_integers INTO g_v_printable_chars.

g_v_len = STRLEN( g_v_string ).

WHILE sy-index LT g_v_len.
  IF g_v_string+sy-index(1) CN g_v_printable_chars.
    g_v_string+sy-index(1) = space.
  ENDIF.
ENDWHILE.

CONDENSE g_v_string NO-GAPS.

WRITE :/ g_v_string.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Jerry Coleman on Mar 27, 2008 1:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600276#M867096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600277#M867097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sandeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         the solution which i can see is.. .. as follows..:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        1) find out the length of string  ex:  v_length = strlen(v_str).&lt;/P&gt;&lt;P&gt;        2) use do loop.....&lt;/P&gt;&lt;P&gt;                         &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;do v_length times.
                               v_index = sy-indiex.
                               
                               if v_str+v_index(1) CA (a-z or 0-9).
                                l_str+ctr(1) = v_str+v_index(1).  
                                ctr = ctr + 1.
                               endif.
                           endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        3) in the above code i am trying to read the characters which is not special characters....&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;P&gt;    all the very best.....&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;     regards,&lt;/P&gt;&lt;P&gt;     sreenivasa sarma k.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:46:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600277#M867097</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation - REPLACE ALL OCCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600278#M867098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for ur replies. I am awarding points to most of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 17:57:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation-replace-all-occurrences/m-p/3600278#M867098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T17:57:49Z</dc:date>
    </item>
  </channel>
</rss>

