<?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: Replacing blank spaces using 'Replace' statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879670#M369508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try TRANSLATE str USING ' _'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If in doubt, type translate in your program, click on iot and hit F1 for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point if it helps please!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jan 2007 13:39:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-23T13:39:55Z</dc:date>
    <item>
      <title>Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879664#M369502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to replace blank spaces in a sentence with underscore?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use :    &amp;lt;b&amp;gt;Replace space in str  with '_' .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;This statement inserts underscore in front of the string even though there is no space in the beginning or end of the string. &lt;/P&gt;&lt;P&gt;e.g.. If str is 'Award Notice'&lt;/P&gt;&lt;P&gt;Result will be  '_Award Notice'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use: &amp;lt;b&amp;gt;Replace all occurrences of space in str  with '_' .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;It gives a short dump: 'Endless loop'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:26:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879664#M369502</guid>
      <dc:creator>former_member17102</dc:creator>
      <dc:date>2007-01-23T13:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879665#M369503</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;U can do like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: str type string value 'Award Notice',&lt;/P&gt;&lt;P&gt;        str1 like str,&lt;/P&gt;&lt;P&gt;        str1 like str.&lt;/P&gt;&lt;P&gt;SPLIT str at space into str1 str2.&lt;/P&gt;&lt;P&gt;concatenate str1 str2 into str seperated by '_'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve ur problem.&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:33:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879665#M369503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879666#M369504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not sure if there´s a possibility, but i would then check for the ASCII-value of space which is 32.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:33:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879666#M369504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879667#M369505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ychatest LINE-COUNT 50.

DATA : v_str(15),
       v1 TYPE i value 0,
       len TYPE i.

v_str = 'Award Notice'.

len = STRLEN( v_str ).

DO len TIMES.
  IF v_str+v1(1) EQ space.
    move '_' to v_str+v1(1).
  ENDIF.
   v1 = v1 + 1.
ENDDO.

write : v_str.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:35:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879667#M369505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879668#M369506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;execute the code .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data:  str(15) type c value ' Award Notice'.
write:/ str.
replace ' '  with '_' into str.
write:/ str.&lt;/CODE&gt;&lt;/PRE&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>Tue, 23 Jan 2007 13:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879668#M369506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879669#M369507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;vijay, awesome !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:36:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879669#M369507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879670#M369508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try TRANSLATE str USING ' _'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If in doubt, type translate in your program, click on iot and hit F1 for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point if it helps please!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879670#M369508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879671#M369509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeba&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The REPLACEMENT statement will not work (see documentation of ABAP statement). However, you could user either &amp;lt;b&amp;gt;OVERLAY&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;SPLIT&amp;lt;/b&amp;gt; for replacing the spaces with any other sign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_REPLACE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_replace.



DATA:
  gd_string      TYPE string,
  gd_string_sav  TYPE string,
  gd_string_new  TYPE string,
  gt_split       TYPE TABLE OF string.





START-OF-SELECTION.

  gd_string = 'Award notice for me!'.
  WRITE: / gd_string.


* NOTE: replace does not work -&amp;gt; see documentation of ABAP statement:
*Exceptions
*Catchable Exceptions
*
*
*
*CX_SY_RANGE_OUT_OF_BOUNDS
*
*Cause: Offset or length specification violated the bounds of character
*string dobj.
*Runtime Error: REFI_WRONG_SECTION (catchable)


* NOTE: works but "overlay" string must be sufficient long!
*  overlay gd_string with '_______________________'.
*  write: / gd_string.

  SPLIT gd_string AT ' ' INTO TABLE gt_split.

  LOOP AT gt_split INTO gd_string.
    gd_string_sav = gd_string.

    AT FIRST.
      gd_string_new = gd_string_sav.
      CONTINUE.
    ENDAT.

    AT LAST.
      CONCATENATE gd_string_new gd_string_sav INTO gd_string_new.
      CONTINUE.
    ENDAT.


    CONCATENATE gd_string_new gd_string_sav INTO gd_string_new
      SEPARATED BY '_'.
  ENDLOOP.

  WRITE: / gd_string_new.

END-OF-SELECTION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 14:01:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879671#M369509</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-01-23T14:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879672#M369510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to do this use :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRANSLATE str USING ' _'.   " there is a blank before the underscore ! 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It should work !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erwan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 14:16:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879672#M369510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T14:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank spaces using 'Replace' statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879673#M369511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: val(30)  type c.
val = ' Award        Notice'.

translate val using ' _'.

write:/ val .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&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;/P&gt;&lt;P&gt;DATA : val(30)  type c.&lt;/P&gt;&lt;P&gt;data : final(30) type c,&lt;/P&gt;&lt;P&gt;       cnt type i,&lt;/P&gt;&lt;P&gt;       v type c,&lt;/P&gt;&lt;P&gt;       n type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val = ' AWARD       NOTICE'.&lt;/P&gt;&lt;P&gt;cnt = strlen( val ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do cnt times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move val+n(1) to v.&lt;/P&gt;&lt;P&gt;if v EQ ' '.&lt;/P&gt;&lt;P&gt;move '_' to final+n(1).&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;move V to final+n(1).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;N =  N + 1.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write:/ final .&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>Tue, 23 Jan 2007 14:32:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-blank-spaces-using-replace-statement/m-p/1879673#M369511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T14:32:22Z</dc:date>
    </item>
  </channel>
</rss>

