<?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 Problem with Replace statement? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312316#M1027976</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;             I am using Replace statement for replacing '%20' in a partucular field like given below&lt;/P&gt;&lt;P&gt;"  Replace All occurrences of REGEX '%20' in I_ZSTR_BPSITEUSER-FIRSTNAME with space ."&lt;/P&gt;&lt;P&gt;   But the problem is if Firstname = " Gopi%20%20%20A " after using this replace i am getting as &lt;/P&gt;&lt;P&gt;" GopiA " but what my req is i need like "Gopi   A"(i want spaces in %20 place)so how to get it?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jul 2008 20:23:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-30T20:23:13Z</dc:date>
    <item>
      <title>Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312316#M1027976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;             I am using Replace statement for replacing '%20' in a partucular field like given below&lt;/P&gt;&lt;P&gt;"  Replace All occurrences of REGEX '%20' in I_ZSTR_BPSITEUSER-FIRSTNAME with space ."&lt;/P&gt;&lt;P&gt;   But the problem is if Firstname = " Gopi%20%20%20A " after using this replace i am getting as &lt;/P&gt;&lt;P&gt;" GopiA " but what my req is i need like "Gopi   A"(i want spaces in %20 place)so how to get it?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 20:23:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312316#M1027976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T20:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312317#M1027977</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 sorry I am not sure how to use the regular expressions..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this..it worked..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: patt TYPE string VALUE '%20',
      text TYPE char100 VALUE 'Gopi%20%20%20A'.

DATA: result_tab TYPE match_result_tab.

FIELD-SYMBOLS &amp;lt;match&amp;gt; LIKE LINE OF result_tab.

* Find
FIND ALL OCCURRENCES OF patt IN
     text
     RESULTS result_tab.

* Replace
LOOP AT result_tab ASSIGNING &amp;lt;match&amp;gt;.
  text+&amp;lt;match&amp;gt;-offset(&amp;lt;match&amp;gt;-length) = space.
ENDLOOP.

WRITE: / text.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 20:57:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312317#M1027977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T20:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312318#M1027978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naren,&lt;/P&gt;&lt;P&gt;             Thanks for ur reply.But still small probs if u enter %20 i want only single space not multiple spaces ok with ur logic i am getting more spaces for each %20 like more than one can u make it just one space for each %20.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gopi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:28:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312318#M1027978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T21:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312319#M1027979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not pretty but works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: string(80)  TYPE c VALUE 'Reich%20%20%20M',
      string2(80) TYPE c,
      string3(80) TYPE c,
      search(3)   TYPE c VALUE '%20',
      continue(1) TYPE c VALUE 'Y',
      i_off       TYPE i.

WHILE continue = 'Y'.
  REPLACE FIRST OCCURRENCE OF search IN string WITH space.

  FIND search IN string MATCH OFFSET i_off.

  IF string+i_off(6) = search.
    continue = 'Y'.
  ELSE.
    SPLIT string AT search INTO string2 string3.
    SHIFT string3 LEFT DELETING LEADING search.
    continue = 'N'.
  ENDIF.
ENDWHILE.

CLEAR string.
CONCATENATE string2 string3 INTO string SEPARATED BY space.

WRITE: string.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:34:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312319#M1027979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T21:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312320#M1027980</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;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: patt TYPE string VALUE '%20',
      text TYPE char100 VALUE 'Gopi%20%20%20A'.

DATA: result_tab TYPE match_result_tab.
DATA: v_length TYPE i.

FIELD-SYMBOLS &amp;lt;match&amp;gt; LIKE LINE OF result_tab.

* Find
FIND ALL OCCURRENCES OF patt IN
     text
     RESULTS result_tab.

SORT result_tab BY offset DESCENDING.

* Replace
LOOP AT result_tab ASSIGNING &amp;lt;match&amp;gt;.

  v_length = &amp;lt;match&amp;gt;-length - 1.
  text+&amp;lt;match&amp;gt;-offset(v_length) = space.

  SHIFT text+&amp;lt;match&amp;gt;-offset LEFT DELETING LEADING space.

  text+&amp;lt;match&amp;gt;-offset(1) = space.

ENDLOOP.

WRITE: / text.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 22:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312320#M1027980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T22:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Replace statement?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312321#M1027981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_data = 'Gopi%20%20%20A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;  replace '%20' with space into w_data.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / w_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 14:36:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-replace-statement/m-p/4312321#M1027981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T14:36:45Z</dc:date>
    </item>
  </channel>
</rss>

