<?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 space in a string to underscore in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767263#M1117484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little late, but I just ran into this problem for the first time.&amp;nbsp; Another option I would suggest is:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;REPLACE [ALL OCCURENCES OF] REGEX &lt;SPAN class="L0S33"&gt;'\s' &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;IN ls_text&lt;/SPAN&gt; &lt;SPAN class="L0S52"&gt;WITH &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'_'&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Sep 2013 15:05:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-09-13T15:05:06Z</dc:date>
    <item>
      <title>Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767251#M1117472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to replace space in a string to an underscore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg : 'LN MAT' should be changed to LN_MAT.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : ls_text type mara-matnr. &lt;/P&gt;&lt;P&gt;REPLACE ALLOCCURRENCES OF SPACES&lt;/P&gt;&lt;P&gt;       of ls_text with '_". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime exception REPLACE_INFINITE_LOOP  is thrown. Could anyone please help&lt;/P&gt;&lt;P&gt;me out as to what is the solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Sudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:45:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767251#M1117472</guid>
      <dc:creator>sudha_naik</dc:creator>
      <dc:date>2008-11-05T09:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767252#M1117473</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;Give me one example with the value from the table which you want to place _ in space.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:50:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767252#M1117473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767253#M1117474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to change the string  'LN MAT' in to LN_MAT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The string 'LN MAT' contain a space in between.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:52:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767253#M1117474</guid>
      <dc:creator>sudha_naik</dc:creator>
      <dc:date>2008-11-05T09:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767254#M1117475</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;U can use replace first occurance of ' ' with '_' instead of replace all occurances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:53:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767254#M1117475</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767255#M1117476</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;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: y_v_text TYPE char10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE: 'LN MAT'  TO y_v_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ' ' WITH '_' INTO y_v_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE:/ y_v_text.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:56:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767255#M1117476</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767256#M1117477</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;check the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  BEGIN OF wa,
    data(255),
  END OF wa.

DATA:
  itab LIKE STANDARD TABLE OF wa WITH HEADER LINE.

DATA:
  v_string1 TYPE string VALUE 'LV MAT',
  v_string2 type string.

SPLIT v_string1 AT space INTO TABLE itab.

loop at itab.
  concatenate v_string2 itab-data into v_string2 separated by '_'.
endloop.

shift v_string2 left deleting leading '_'.

write: / v_string2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Navneeth K.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:56:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767256#M1117477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767257#M1117478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just use TRANSLATE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRANSLATE string USING ' _'. "pls. note there is a space before the undersore&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:58:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767257#M1117478</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-11-05T09:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767258#M1117479</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;replace all occurrences of space&lt;/P&gt;&lt;P&gt;                    in &amp;lt;field&amp;gt; with '_' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:58:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767258#M1117479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767259#M1117480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;use this TRANSLATE abc USING ' _'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note that inside the quotes we have space followed by _ which means replace space by _.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try sap help for translate for more info.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:59:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767259#M1117480</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767260#M1117481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use IN in PLace of OF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPLACE ALLOCCURRENCES OF SPACES IN ls_text with '_". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will Work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:59:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767260#M1117481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767261#M1117482</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;Please check if the material number is empty. Because the error that you are getting is one of the exceptions of the REPLACE...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Catchable Exceptions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CX_SY_REPLACE_INFINITE_LOOP&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Cause: Substring of length 0 generates an endless loop when searching for all occurrences.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;Runtime Error: REPLACE_INFINITE_LOOP (catchable)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to catch all the errors and find out the cause for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jayant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 09:59:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767261#M1117482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T09:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767262#M1117483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried at my end. The following code works :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;  replace space with '_' into ls_text .&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers !! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neeraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2008 10:30:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767262#M1117483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-05T10:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767263#M1117484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little late, but I just ran into this problem for the first time.&amp;nbsp; Another option I would suggest is:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;REPLACE [ALL OCCURENCES OF] REGEX &lt;SPAN class="L0S33"&gt;'\s' &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;IN ls_text&lt;/SPAN&gt; &lt;SPAN class="L0S52"&gt;WITH &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'_'&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 15:05:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767263#M1117484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-09-13T15:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replace space in a string to underscore</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767264#M1117485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE&gt;REPLACE ALL OCCURRENCES OF &lt;STRONG&gt;` `&lt;/STRONG&gt; IN ls_text WITH '_'.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;Please use Grave Accent ( ` ) instead of Apostrophe ( ' ), otherwise the expression ' ' will be handled like empty.&lt;/P&gt;&lt;P&gt;The expression ` ` will be handled as string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 15:41:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replace-space-in-a-string-to-underscore/m-p/4767264#M1117485</guid>
      <dc:creator>roland_knaupp1</dc:creator>
      <dc:date>2014-11-10T15:41:23Z</dc:date>
    </item>
  </channel>
</rss>

