<?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: REPLACE ALL OCURRENCES in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162903#M457685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;handling single quote&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option 1.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; `'`&amp;lt;/b&amp;gt; single quote surronded by the symbole in key to the left of number 1 in your key board. (sorry dont know the name of the symbol)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option two&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'''' (thats four single quotes)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2007 08:58:38 GMT</pubDate>
    <dc:creator>athavanraja</dc:creator>
    <dc:date>2007-05-02T08:58:38Z</dc:date>
    <item>
      <title>REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162897#M457679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to replace the character ' in a string, but the compiler doesn't allow me to use something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ALL OCURRENCES ''' in: local_string with space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody know, how to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Hercules&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:33:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162897#M457679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162898#M457680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To replace a string in a field with a different string, use the REPLACE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE &amp;lt;str1&amp;gt; WITH &amp;lt;str2&amp;gt; INTO &amp;lt;c&amp;gt; [LENGTH &amp;lt;l&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement searches the field &amp;lt;c&amp;gt; for the first occurrence of the first &amp;lt;l&amp;gt; positions of the pattern &amp;lt;str1&amp;gt;. If no length is specified, it searches for the pattern &amp;lt;str1&amp;gt; in its full length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, the statement replaces the first occurrence of the pattern &amp;lt;str1&amp;gt; in field &amp;lt;c&amp;gt; with the string &amp;lt;str2&amp;gt;. If a length &amp;lt;l&amp;gt; was specified, only the relevant part of the pattern is replaced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:35:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162898#M457680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162899#M457681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To replace a string in a field with a different string, use the REPLACE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;REPLACE &amp;lt;str1&amp;gt; WITH &amp;lt;str2&amp;gt; INTO &amp;lt;c&amp;gt; [LENGTH &amp;lt;l&amp;gt;].&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement searches the field &amp;lt;c&amp;gt; for the first occurrence of the first &amp;lt;l&amp;gt; positions of the pattern &amp;lt;str1&amp;gt;. If no length is specified, it searches for the pattern &amp;lt;str1&amp;gt; in its full length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, the statement replaces the first occurrence of the pattern &amp;lt;str1&amp;gt; in field &amp;lt;c&amp;gt; with the string &amp;lt;str2&amp;gt;. If a length &amp;lt;l&amp;gt; was specified, only the relevant part of the pattern is replaced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the return code value of the system field SY-SUBRC is set to 0, this indicates that &amp;lt;str1&amp;gt; was found in &amp;lt;c&amp;gt; and replaced by &amp;lt;str2&amp;gt;. A return code value other than 0 means that nothing was replaced. &amp;lt;str1&amp;gt;, &amp;lt;str2&amp;gt;, and &amp;lt;len&amp;gt; can be variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: T(10) VALUE 'abcdefghij',
STRING LIKE T,
STR1(4) VALUE 'cdef',
STR2(4) VALUE 'klmn',
STR3(2) VALUE 'kl',
STR4(6) VALUE 'klmnop',
LEN TYPE I VALUE 2.

STRING = T.
WRITE STRING.

REPLACE STR1 WITH STR2 INTO STRING.
WRITE / STRING.

STRING = T.
REPLACE STR1 WITH STR2 INTO STRING LENGTH LEN.
WRITE / STRING.

STRING = T.
REPLACE STR1 WITH STR3 INTO STRING.
WRITE / STRING.

STRING = T.
REPLACE STR1 WITH STR4 INTO STRING.
WRITE / STRING.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abcdefghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnefgh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklghij&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abklmnopgh&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note how, in the last line, the field STRING is truncated on the right. The search pattern 'cdef' of length 4 is replaced by 'klmnop' of length 6. Then, the rest of the field STRING is filled up to the end of the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Rk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:36:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162899#M457681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162900#M457682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use TRANSLATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRANSLATE local_string USING '` '. "&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; --&amp;gt; Use single quote above TAB key in keyboard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162900#M457682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162901#M457683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Hercules, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;copy this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;REPLACE ALL OCURRENCES  of `'`  in local_string with space.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the QUOTE symbol that i have used are not the normal quotes.&lt;/P&gt;&lt;P&gt;It is the QUOTE symbol that is above the TAB key in the keyboard.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:39:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162901#M457683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162902#M457684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just check out this code if it helps you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: v_char(60) VALUE 'India has ''greate'' history and ''rich''&lt;/P&gt;&lt;P&gt;heritage'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRANSLATE v_char USING ''' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condense v_char.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: v_char.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162902#M457684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-02T08:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: REPLACE ALL OCURRENCES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162903#M457685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;handling single quote&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option 1.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; `'`&amp;lt;/b&amp;gt; single quote surronded by the symbole in key to the left of number 1 in your key board. (sorry dont know the name of the symbol)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;option two&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'''' (thats four single quotes)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2007 08:58:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-all-ocurrences/m-p/2162903#M457685</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2007-05-02T08:58:38Z</dc:date>
    </item>
  </channel>
</rss>

