<?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 Concatenating strings with trailing whitespace in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033694#M84578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a String 'ABC XYZ ' which has a trailing space character. This string has to be concatenated with another string '1234'. The expected output is          &lt;/P&gt;&lt;P&gt;'ABC XYZ 1234'&lt;/P&gt;&lt;P&gt;I'm using the concatenate function but the whitespace after XYZ is getting truncated and the output is coming as 'ABC XYZ1234'. I tried concatenating a whitespace also &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE 'ABC XYZ' ' ' '1234'INTO temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the result is the same. Does someone have a solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Oct 2005 05:30:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-10-19T05:30:43Z</dc:date>
    <item>
      <title>Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033694#M84578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a String 'ABC XYZ ' which has a trailing space character. This string has to be concatenated with another string '1234'. The expected output is          &lt;/P&gt;&lt;P&gt;'ABC XYZ 1234'&lt;/P&gt;&lt;P&gt;I'm using the concatenate function but the whitespace after XYZ is getting truncated and the output is coming as 'ABC XYZ1234'. I tried concatenating a whitespace also &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE 'ABC XYZ' ' ' '1234'INTO temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the result is the same. Does someone have a solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 05:30:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033694#M84578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T05:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033695#M84579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CONCATENATE 'ABC' 'XYZ' '1234' INTO v_zzz SEPERATED BY SPACE.

OR Try this

CONSTANTS: c_abc(7) VALUE 'ABC XYZ',
           c_1234(4) VALUE '1234'.

DATA: v_xyz(12) TYPE C.
Then write 

CONCATENATE c_abc c_1234 INTO v_xyz &amp;lt;b&amp;gt;SEPERATED BY SPACE&amp;lt;/b&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly reward points and close the thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 05:32:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033695#M84579</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T05:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033696#M84580</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;The CONCATENATE statement combines two or more separate strings into one. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt; INTO &amp;lt;c&amp;gt; [SEPARATED BY &amp;lt;s&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement concatenates the character fields &amp;lt;c1&amp;gt; to &amp;lt;cn&amp;gt; and assigns the result to &amp;lt;c&amp;gt;. &amp;lt;b&amp;gt;The system ignores spaces at the end of the individual source strings&amp;lt;/b&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The addition SEPARATED BY &amp;lt;s&amp;gt; allows you to specify a character field &amp;lt;s&amp;gt; which is placed in its defined length between the individual fields.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the result fits into &amp;lt;c&amp;gt;, SY-SUBRC is set to 0. However, if the result has to be truncated, SY-SUBRC is set to 4.&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: C1(10) VALUE 'Sum',&lt;/P&gt;&lt;P&gt;C2(3) VALUE 'mer',&lt;/P&gt;&lt;P&gt;C3(5) VALUE 'holi ',&lt;/P&gt;&lt;P&gt;C4(10) VALUE 'day',&lt;/P&gt;&lt;P&gt;C5(30),&lt;/P&gt;&lt;P&gt;SEP(3) VALUE ' - '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE C1 C2 C3 C4 INTO C5.&lt;/P&gt;&lt;P&gt;WRITE C5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE C1 C2 C3 C4 INTO C5 SEPARATED BY SEP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE / C5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summerholiday&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum - mer - holi - day&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In C1 to C5, the trailing blanks are ignored. The separator SEP retains them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ruthra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 05:35:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033696#M84580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T05:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033697#M84581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Sandeep,&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;CONCATENATE 'ABC XYZ' '1234'INTO TEMP SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kingshuk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 05:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033697#M84581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T05:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033698#M84582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to preserve the white spaces you can do the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate &amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt;This &amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt;is&amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt; test.&amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt; into &amp;lt;var&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that i have not used single quote , instead used &amp;lt;b&amp;gt;`&amp;lt;/b&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 05:43:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033698#M84582</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2005-10-19T05:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033699#M84583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kindly reward if ur problem got solved or get back with queries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 06:54:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033699#M84583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T06:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033700#M84584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm astonished that no one mentioned the "in character mode" to make the program unicode capable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 07:07:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033700#M84584</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2005-10-19T07:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033701#M84585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you do not specify the mode, character string processing is performed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 07:26:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033701#M84585</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2005-10-19T07:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033702#M84586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this might help u out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Concatenating Character Strings&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;The CONCATENATE statement combines two or more separate strings into one.&lt;/P&gt;&lt;P&gt;CONCATENATE &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt; INTO &amp;lt;c&amp;gt; [SEPARATED BY &amp;lt;s&amp;gt;].&lt;/P&gt;&lt;P&gt;This statement concatenates the character fields &amp;lt;c1&amp;gt; to &amp;lt;cn&amp;gt; and assigns the result to &amp;lt;c&amp;gt;. The&lt;/P&gt;&lt;P&gt;system ignores spaces at the end of the individual source strings.&lt;/P&gt;&lt;P&gt;The addition SEPARATED BY &amp;lt;s&amp;gt; allows you to specify a character field &amp;lt;s&amp;gt; which is placed in&lt;/P&gt;&lt;P&gt;its defined length between the individual fields.&lt;/P&gt;&lt;P&gt;If the result fits into &amp;lt;c&amp;gt;, SY-SUBRC is set to 0. However, if the result has to be truncated, SYSUBRC&lt;/P&gt;&lt;P&gt;is set to 4.&lt;/P&gt;&lt;P&gt;DATA: C1(10) VALUE 'Sum',&lt;/P&gt;&lt;P&gt;C2(3) VALUE 'mer',&lt;/P&gt;&lt;P&gt;C3(5) VALUE 'holi ',&lt;/P&gt;&lt;P&gt;C4(10) VALUE 'day',&lt;/P&gt;&lt;P&gt;C5(30),&lt;/P&gt;&lt;P&gt;SEP(3) VALUE ' - '.&lt;/P&gt;&lt;P&gt;CONCATENATE C1 C2 C3 C4 INTO C5.&lt;/P&gt;&lt;P&gt;WRITE C5.&lt;/P&gt;&lt;P&gt;CONCATENATE C1 C2 C3 C4 INTO C5 SEPARATED BY SEP.&lt;/P&gt;&lt;P&gt;WRITE / C5.&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;Summerholiday&lt;/P&gt;&lt;P&gt;Sum - mer - holi - day&lt;/P&gt;&lt;P&gt;In C1 to C5, the trailing blanks are ignored. The separator SEP retains them.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Splitting Character Strings&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;To split a character string into two or more smaller strings, use the SPLIT statement as follows:&lt;/P&gt;&lt;P&gt;SPLIT &amp;lt;c&amp;gt; AT &amp;lt;del&amp;gt; INTO &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt;.&lt;/P&gt;&lt;P&gt;The system searches the field &amp;lt;c&amp;gt; for the separator &amp;lt;del&amp;gt;. The parts before and after the&lt;/P&gt;&lt;P&gt;separator are placed in the target fields &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt;.&lt;/P&gt;&lt;P&gt;To place all fragments in different target fields, you must specify enough target fields. Otherwise,&lt;/P&gt;&lt;P&gt;the last target field is filled with the rest of the field &amp;lt;c&amp;gt; and still contains delimiters.&lt;/P&gt;&lt;P&gt;If all target fields are long enough and no fragment has to be truncated, SY-SUBRC is set to 0.&lt;/P&gt;&lt;P&gt;Otherwise it is set to 4.&lt;/P&gt;&lt;P&gt;DATA: STRING(60),&lt;/P&gt;&lt;P&gt;P1(20) VALUE '++++++++++++++++++++',&lt;/P&gt;&lt;P&gt;P2(20) VALUE '++++++++++++++++++++',&lt;/P&gt;&lt;P&gt;P3(20) VALUE '++++++++++++++++++++',&lt;/P&gt;&lt;P&gt;P4(20) VALUE '++++++++++++++++++++',&lt;/P&gt;&lt;P&gt;DEL(3) VALUE '***'.&lt;/P&gt;&lt;P&gt;STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.&lt;/P&gt;&lt;P&gt;WRITE STRING.&lt;/P&gt;&lt;P&gt;SPLIT STRING AT DEL INTO P1 P2 P3 P4.&lt;/P&gt;&lt;P&gt;WRITE / P1.&lt;/P&gt;&lt;P&gt;WRITE / P2.&lt;/P&gt;&lt;P&gt;WRITE / P3.&lt;/P&gt;&lt;P&gt;WRITE / P4.&lt;/P&gt;&lt;P&gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5&lt;/P&gt;&lt;P&gt;Part 1&lt;/P&gt;&lt;P&gt;Part 2&lt;/P&gt;&lt;P&gt;Part 3&lt;/P&gt;&lt;P&gt;Part 4 *** Part 5&lt;/P&gt;&lt;P&gt;Note that the contents of the fields P1 ...P4 are totally overwritten and that they are&lt;/P&gt;&lt;P&gt;filled out with trailing blanks.&lt;/P&gt;&lt;P&gt;You can also split a string into the individual lines of an internal table as follows:&lt;/P&gt;&lt;P&gt;SPLIT &amp;lt;c&amp;gt; AT &amp;lt;del&amp;gt; INTO TABLE &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;The system adds a new line to the internal table &amp;lt;itab&amp;gt; for each part of the string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 09:33:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033702#M84586</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-19T09:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating strings with trailing whitespace</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033703#M84587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In unicode you have to specify either in character mode or in byte mode. So why not make programs for the future and just add these three words. to do it or not is not a discussiuon worth, just do it and your programmes part of life will be easier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2005 09:54:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/concatenating-strings-with-trailing-whitespace/m-p/1033703#M84587</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2005-10-19T09:54:27Z</dc:date>
    </item>
  </channel>
</rss>

