<?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 statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453040#M549828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;chk this example

Pattern-based replacement of all found location of the word "know" in the data objects text1 and text2 by "should know that". After the first REPLACE statement, text1 contains the complete content "I should know that You should know that ", and sy-subrc contains the value 0. The data objects cnt, off, and len contain the values 2, 23, and 16 respectively. After the second REPLACE statement, text2 contains the truncated content "I should know that" and sy-subrc contains the value 2. The data objects cnt, off, and len contain the values 1, 2, and 16. 

DATA: text1 TYPE string, 
      text2(18) TYPE c, 
      cnt TYPE i, 
      off TYPE i, 
      len TYPE i. 

text1 = text2 = 'I know you know'. 

REPLACE ALL OCCURRENCES OF 'know' IN: 
        text1 WITH 'should know that' 
              REPLACEMENT COUNT  cnt 
              REPLACEMENT OFFSET off 
              REPLACEMENT LENGTH len, 
        text2 WITH 'should know that' 
              REPLACEMENT COUNT  cnt 
              REPLACEMENT OFFSET off 
              REPLACEMENT LENGTH len.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jun 2007 08:27:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-26T08:27:11Z</dc:date>
    <item>
      <title>replace statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453037#M549825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey ABAP, i have following Problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF '.' IN SECTION OFFSET lv_offset of lv_kstbm.&lt;/P&gt;&lt;P&gt;when trying to compile this, it tells me that between "OFFSET" and "of" LENGTH is expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF '.' IN SECTION OFFSET lv_offset LENGTH lv_length of lv_kstbm.&lt;/P&gt;&lt;P&gt;when compiling this one, it tells me "length lv_length" isnt expected to be there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_length and LV-offset are both local variables of type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 08:19:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453037#M549825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-26T08:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: replace statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453038#M549826</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;  i think you have to complete the statement with the WITH text addition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF '.' IN SECTION OFFSET lv_offset LENGTH lv_length of lv_kstbm WITH 'something'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helpful, reward&lt;/P&gt;&lt;P&gt;Sathish. R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 08:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453038#M549826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-26T08:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: replace statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453039#M549827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think you are combining two things in one...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by pattern replacing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: c4(4) TYPE C. &lt;/P&gt;&lt;P&gt;c4 = 'abab'. &lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF 'ab' IN c4 WITH 'CCC'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by position replacing...&lt;/P&gt;&lt;P&gt;DATA: text TYPE STRING. &lt;/P&gt;&lt;P&gt;text = 'abcdefgh'. &lt;/P&gt;&lt;P&gt;REPLACE SECTION OFFSET 4 OF text WITH 'XXXX'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one of them can be used at a time..&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 08:24:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453039#M549827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-26T08:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: replace statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453040#M549828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;chk this example

Pattern-based replacement of all found location of the word "know" in the data objects text1 and text2 by "should know that". After the first REPLACE statement, text1 contains the complete content "I should know that You should know that ", and sy-subrc contains the value 0. The data objects cnt, off, and len contain the values 2, 23, and 16 respectively. After the second REPLACE statement, text2 contains the truncated content "I should know that" and sy-subrc contains the value 2. The data objects cnt, off, and len contain the values 1, 2, and 16. 

DATA: text1 TYPE string, 
      text2(18) TYPE c, 
      cnt TYPE i, 
      off TYPE i, 
      len TYPE i. 

text1 = text2 = 'I know you know'. 

REPLACE ALL OCCURRENCES OF 'know' IN: 
        text1 WITH 'should know that' 
              REPLACEMENT COUNT  cnt 
              REPLACEMENT OFFSET off 
              REPLACEMENT LENGTH len, 
        text2 WITH 'should know that' 
              REPLACEMENT COUNT  cnt 
              REPLACEMENT OFFSET off 
              REPLACEMENT LENGTH len.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 08:27:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-statement/m-p/2453040#M549828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-26T08:27:11Z</dc:date>
    </item>
  </channel>
</rss>

