<?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: Finding trailing spaces in a string variable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519574#M18571</link>
    <description>&lt;P&gt;CONCATENATE is a fine example of the difference between strings and chars. By your description, it sounds like you are working with fields of type C, which is not the same as a string. Search string vs char, there have been a few articles written on SCN. &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;output-&amp;gt;write( 'Hello' &amp;amp;&amp;amp; ' ' &amp;amp;&amp;amp; 'world' ).  "text is type C, space = initial, will be removed.
output-&amp;gt;write( `Hello` &amp;amp;&amp;amp; ` ` &amp;amp;&amp;amp; `world` ).  "Text is type string, ` ` is not initial, because ` `&amp;lt;&amp;gt;``. Space stays. &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My personal favourite is to use string templates. If you've never used them, they take a bit of getting used to, but reading the online help is definitively worthwhile: &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;output-&amp;gt;write( |{ `Hello` } { `world` }| ).   "will preserve the space regardless of the data types&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 04 Aug 2017 16:40:40 GMT</pubDate>
    <dc:creator>pokrakam</dc:creator>
    <dc:date>2017-08-04T16:40:40Z</dc:date>
    <item>
      <title>Finding trailing spaces in a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519573#M18570</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;I have to build a JSON string by concatenating couple of string variables. Lets say str1 = 'The Sun is shining ' str2 = 'and the weather is nice'. Now the issue is:-&lt;/P&gt;
  &lt;P&gt;1. Concatenate str1 str2 will result in -The Sun is shiningand the weather is nice.&lt;/P&gt;
  &lt;P&gt;i.e it will remove the trailing space from str1.&lt;/P&gt;
  &lt;P&gt; 2. Respecting blanks will not work since its a string variable and I cannot use a char as per my req where the length of the variable varies.&lt;/P&gt;
  &lt;P&gt; Therefore I thought of finding the number of trailing white space in str1 i.e. FIND ' ' in str1 results tab1 and then adding those spaces in the final string. But that also doesn't seem to work.&lt;/P&gt;
  &lt;P&gt; Is there any other way I can solve this?&lt;/P&gt;
  &lt;P&gt; Thanks,&lt;/P&gt;
  &lt;P&gt;Faiz&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 16:04:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519573#M18570</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-08-04T16:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding trailing spaces in a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519574#M18571</link>
      <description>&lt;P&gt;CONCATENATE is a fine example of the difference between strings and chars. By your description, it sounds like you are working with fields of type C, which is not the same as a string. Search string vs char, there have been a few articles written on SCN. &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;output-&amp;gt;write( 'Hello' &amp;amp;&amp;amp; ' ' &amp;amp;&amp;amp; 'world' ).  "text is type C, space = initial, will be removed.
output-&amp;gt;write( `Hello` &amp;amp;&amp;amp; ` ` &amp;amp;&amp;amp; `world` ).  "Text is type string, ` ` is not initial, because ` `&amp;lt;&amp;gt;``. Space stays. &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My personal favourite is to use string templates. If you've never used them, they take a bit of getting used to, but reading the online help is definitively worthwhile: &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;output-&amp;gt;write( |{ `Hello` } { `world` }| ).   "will preserve the space regardless of the data types&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Aug 2017 16:40:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519574#M18571</guid>
      <dc:creator>pokrakam</dc:creator>
      <dc:date>2017-08-04T16:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Finding trailing spaces in a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519575#M18572</link>
      <description>&lt;P&gt;This worked for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks a ton Mike !!! &lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 18:56:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519575#M18572</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-08-04T18:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Finding trailing spaces in a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519576#M18573</link>
      <description>&lt;P&gt;&lt;A href="https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenstring_processing_trail_blanks.htm" target="test_blank"&gt;https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenstring_processing_trail_blanks.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2017 07:32:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-trailing-spaces-in-a-string-variable/m-p/519576#M18573</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-08-05T07:32:01Z</dc:date>
    </item>
  </channel>
</rss>

