<?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 until to one character in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284980#M1532035</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use  &lt;STRONG&gt;REPLACE ALL OCCURRENCES&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check then following link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://wiki.sdn.sap.com/wiki/display/HOME/Message" target="test_blank"&gt;http://wiki.sdn.sap.com/wiki/display/HOME/Message&lt;/A&gt;&lt;EM&gt;Mapping&lt;/EM&gt;&lt;EM&gt;Replace&lt;/EM&gt;String&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kk.adhvaryu on Sep 30, 2010 10:25 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Sep 2010 08:23:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-30T08:23:13Z</dc:date>
    <item>
      <title>Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284974#M1532029</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 have the following string for example: 'B B B B'. Is it possible to replace three of them with SPACE and get only one 'B'?&lt;/P&gt;&lt;P&gt;The problem is that it is also possible to get only 'B B' or 'B'. There i should also get only one 'B'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this with the addition REPLACEMENT OFFSET but it doesn`t work because i do a CONDENSE after replacing and so the offset is always 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Timo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 14:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284974#M1532029</guid>
      <dc:creator>TimoRenz</dc:creator>
      <dc:date>2010-09-29T14:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284975#M1532030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on your description, I propose the following solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lf_string = 'B'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is probably not what you're looking for, so please provide a more descriptive example, maybe with actual values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:05:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284975#M1532030</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-09-29T15:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284976#M1532031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sure there is a better way, but this works for sure.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: new_string LIKE old_string.
DO.
MOVE old_string TO new_string.
REPLACE wanted_char INTO new_string WITH space.

if NOT new_string CA wanted_char.
MOVE old_string to new_string.
EXIT.
ENDIF.
ENDDO.
WRITE: /1 new_string.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Where OLD_STRING = your initial string,&lt;/P&gt;&lt;P&gt;           WANTED_CHAR = the char you want to search and replace until only 1 remain&lt;/P&gt;&lt;P&gt;           NEW_STRING = The final string&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:33:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284976#M1532031</guid>
      <dc:creator>SimoneMilesi</dc:creator>
      <dc:date>2010-09-29T15:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284977#M1532032</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 way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call first occurance three times to replace with new character with out Offset...as per requirement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        REPLACE first OCCURRENCES OF 'B' IN  w_string WITH space.&lt;/P&gt;&lt;P&gt;        REPLACE first OCCURRENCES OF 'B' IN  w_string WITH  space.&lt;/P&gt;&lt;P&gt;        REPLACE first  OCCURRENCES OF 'B' IN  w_string WITH space'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:41:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284977#M1532032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-29T15:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284978#M1532033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: l_text TYPE string,
      l_rule TYPE char2.

l_text = 'B B'.

IF STRLEN( l_text ) &amp;gt; 1.
  l_rule = l_text(1).
  CONCATENATE l_rule ' ' INTO l_rule.
  TRANSLATE l_text USING l_rule.
  CONCATENATE l_rule(1) l_text+1 INTO l_text.
ENDIF.
write l_text.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Matus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:51:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284978#M1532033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-29T15:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284979#M1532034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you need to replace the consecutive characters. You can check the &lt;STRONG&gt;regex&lt;/STRONG&gt; statements in which this can be done very easily.But im not sure how to build the pattern for this case that too retaining 1 occurrence of consecutive characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; As of now you can check this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:lv_consec TYPE char255 VALUE 'B B B B B B B A A X X'.
DATA:len TYPE i,
     l_off TYPE i.
FIELD-SYMBOLS:&amp;lt;fs&amp;gt;,&amp;lt;fs1&amp;gt;.
condense lv_consec no-gaps.
len = STRLEN( lv_consec ).
l_off = 0.


DO len TIMES.
  IF sy-index = 1.
    ASSIGN lv_consec+l_off(1) TO &amp;lt;fs&amp;gt;.
  ELSE.
    ASSIGN lv_consec+l_off(1) TO &amp;lt;fs1&amp;gt;.
    IF &amp;lt;fs&amp;gt; EQ &amp;lt;fs1&amp;gt;.
      &amp;lt;fs&amp;gt; = ' '.
    ENDIF.
    ASSIGN lv_consec+l_off(1) TO &amp;lt;fs&amp;gt;.
  ENDIF.
  l_off = l_off + 1.
ENDDO.
CONDENSE lv_consec no-gaps.
WRITE lv_consec.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:57:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284979#M1532034</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-29T15:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Replace until to one character</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284980#M1532035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use  &lt;STRONG&gt;REPLACE ALL OCCURRENCES&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check then following link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://wiki.sdn.sap.com/wiki/display/HOME/Message" target="test_blank"&gt;http://wiki.sdn.sap.com/wiki/display/HOME/Message&lt;/A&gt;&lt;EM&gt;Mapping&lt;/EM&gt;&lt;EM&gt;Replace&lt;/EM&gt;String&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kk.adhvaryu on Sep 30, 2010 10:25 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 08:23:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-until-to-one-character/m-p/7284980#M1532035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-30T08:23:13Z</dc:date>
    </item>
  </channel>
</rss>

