<?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: Alternative for REPLACE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183571#M126389</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;   Build logic using search ,overlay,move.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2006 11:29:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-30T11:29:32Z</dc:date>
    <item>
      <title>Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183570#M126388</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 am using the following syntax of REPLACE in a report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE old_character IN my_object WITH new_character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The unique thing about this report is that it has to run &lt;/P&gt;&lt;P&gt;on different versions from 46c.&lt;/P&gt;&lt;P&gt;The above syntax works ok in abap version 7 but is not downward compatible to 46c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody suggest something (of similar functionality) which will work across releases.&lt;/P&gt;&lt;P&gt;Will the older syntax of replace do?&lt;/P&gt;&lt;P&gt;REPLACE old_character WITH new_character INTO my_object.&lt;/P&gt;&lt;P&gt;(Abap help says this is obsolete.)&lt;/P&gt;&lt;P&gt;Any possible help is very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sahir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 11:19:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183570#M126388</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T11:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183571#M126389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;   Build logic using search ,overlay,move.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 11:29:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183571#M126389</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T11:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183572#M126390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you need to use split and concatenate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 11:31:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183572#M126390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T11:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183573#M126391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope this works...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA text(16) VALUE 'THIS IS OLD TEXT'.
DATA new_str(25).
DATA temp(25).
DATA old_char(16) VALUE 'OLD'.
DATA new_char(16) VALUE 'NEW'.
DATA off TYPE i VALUE 0.
DATA moff TYPE i.
DATA mlen TYPE i.
DATA len TYPE i.
DATA flag TYPE i VALUE 0.


len = strlen( new_char ).

DO.
flag = 0.

FIND old_char IN SECTION
  OFFSET off OF text
  MATCH OFFSET moff
  MATCH LENGTH mlen
  .

IF sy-subrc = 0.
  flag = 1.
  WRITE : moff, mlen.
ENDIF.

IF flag = 0.
  off = off + mlen.
  WRITE : / text+off.
  CONCATENATE new_str text+off INTO new_str SEPARATED BY SPACE.
  EXIT.

ENDIF.

*Change repl

CONCATENATE new_str text+off(moff) INTO new_str.
CONCATENATE new_str new_char INTO new_str SEPARATED BY SPACE.

off = moff + 1.

ENDDO.
WRITE / new_str.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ps: Reward points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 11:40:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183573#M126391</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T11:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183574#M126392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use REPLACE A1 WITH A2 INTO A3 syntax variant..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abdul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 11:41:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183574#M126392</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2006-01-30T11:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183575#M126393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;This one replaces all occurances of an old char with new char using no special commands .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : my_obj(100) value 'This is Old Text', new_char value 'a' ,
old_char value 'i'.
data : x type i value 1, y type i, len type i.
describe field my_obj length len in byte mode.


while y ne len.
 if my_obj+y(x) eq old_char.
     my_obj+y(x)  = new_char.
 endif.
y = y + 1.
endwhile.

write : my_obj.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 12:10:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183575#M126393</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T12:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183576#M126394</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 would like to clarify something.&lt;/P&gt;&lt;P&gt;I am trying to replace one string with another in a big string. (Not characters, as i mentioned in the earlier message, sorry for that!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the replies. I am trying out some of them.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sahir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 12:29:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183576#M126394</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T12:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for REPLACE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183577#M126395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sahir,&lt;/P&gt;&lt;P&gt;   the code given above is can be applied to string of any length and even string replacements can be done using the same operation.&lt;/P&gt;&lt;P&gt;this minor change in the previous code ca be made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : my_obj(100) value 'This is Old Text', new_char(100) value 'abcd' ,old_char(100) value 'is' ,str1(100),str2(100).&lt;/P&gt;&lt;P&gt;data : x type i value 1, y type i, len type i , idx type i , offset like sy-index.&lt;/P&gt;&lt;P&gt;describe field my_obj length len in byte mode.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;while y ne len.&lt;/P&gt;&lt;P&gt; if my_obj+y(x) eq space.&lt;/P&gt;&lt;P&gt;   while my_obj+y(x) ne space or y eq len.&lt;/P&gt;&lt;P&gt;     flag = 1. &lt;/P&gt;&lt;P&gt;     offset = sy-index.&lt;/P&gt;&lt;P&gt;     if my_obj&lt;EM&gt;y(x) eq old_char&lt;/EM&gt;idx(x).&lt;/P&gt;&lt;P&gt;      continue.&lt;/P&gt;&lt;P&gt;     else.&lt;/P&gt;&lt;P&gt;      flag = 0.&lt;/P&gt;&lt;P&gt;     endif.     &lt;/P&gt;&lt;P&gt;     y = y + 1.   &lt;/P&gt;&lt;P&gt;     idx = sy-index.&lt;/P&gt;&lt;P&gt;   endwhile.       &lt;/P&gt;&lt;P&gt;y = sy-index.&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if flag = 1.&lt;/P&gt;&lt;P&gt;  str1 = my_obj+(offset).&lt;/P&gt;&lt;P&gt;  str2 = my_obj+idx(*).&lt;/P&gt;&lt;P&gt;  concatenate str1 new_char str2 into my_obj seperated by spaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write : my_obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please Award  points if the answer is helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 12:34:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-replace/m-p/1183577#M126395</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-30T12:34:56Z</dc:date>
    </item>
  </channel>
</rss>

