<?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 How to split a string with a space in between? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538465#M576548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP Guru's,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me out? How can I split a string into two which has a space in between?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: lets suppose the string is 'LA CA USA'. How can I split this string? I have to dynamically determine the number of characters before the space therefore I cannot use number constant such as 2 or 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With best regards,&lt;/P&gt;&lt;P&gt;Ketan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jul 2007 07:07:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-10T07:07:52Z</dc:date>
    <item>
      <title>How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538465#M576548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP Guru's,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me out? How can I split a string into two which has a space in between?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: lets suppose the string is 'LA CA USA'. How can I split this string? I have to dynamically determine the number of characters before the space therefore I cannot use number constant such as 2 or 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With best regards,&lt;/P&gt;&lt;P&gt;Ketan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:07:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538465#M576548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538466#M576549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SPLIT &amp;lt;ITAB/STRING&amp;gt; AT ' ' into table ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward all helpful replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:11:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538466#M576549</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2007-07-10T07:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538467#M576550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ketan,&lt;/P&gt;&lt;P&gt;use 'Replace' space with '$'&lt;/P&gt;&lt;P&gt;It will fill up all spaces with $&lt;/P&gt;&lt;P&gt;and then split at '$'&lt;/P&gt;&lt;P&gt;Reward if useful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:11:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538467#M576550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538468#M576551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;try this..

REPORT ychatest.

DATA : v_str TYPE string VALUE 'LA CSD KDGKL'.

DATA : BEGIN OF itab OCCURS 0,
         fld(250),
       END OF itab.

SPLIT v_str AT space INTO TABLE itab.

LOOP AT itab.
  WRITE : / itab-fld.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538468#M576551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538469#M576552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;split v_name at space into v_a v_b v_c .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:13:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538469#M576552</guid>
      <dc:creator>Shahid</dc:creator>
      <dc:date>2007-07-10T07:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538470#M576553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: itab type table of string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;split your_string at space into itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:14:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538470#M576553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538471#M576554</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;To split a character string into two or more smaller strings, use the SPLIT statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SPLIT &amp;lt;c&amp;gt; AT &amp;lt;del&amp;gt; INTO &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt;.&amp;lt;/b&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 separator are placed in the target fields &amp;lt;c1&amp;gt; ... &amp;lt;cn&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To place all fragments in different target fields, you must specify enough target fields. Otherwise, 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;&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. Otherwise it is set to 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SPLIT LA CA USA  AT ' ' INTO &amp;lt;c1&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;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:26:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538471#M576554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538472#M576555</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 like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : opbal TYPE p DECIMALS 2 VALUE 0.

    SELECT * FROM zs_mkpf_mseg
                    into corresponding fields of table it_opbal
                    WHERE werks =  itmat-werks
                    AND matnr = itmat-matnr
                    AND budat = s_budat-low.


  *  sort  it_opbal by budat.
  loop at it_opbal.
read table it_opbal. 
      IF it_opbal-shkzg = 'S'.
        opbal = opbal + it_opbal-menge.
      ELSEIF it_opbal-shkzg = 'H'.
        opbal = opbal + it_opbal-menge * -1.
      ENDIF.
  endloop.
    append opbal TO itab-opbal.

  ENDFORM.                    " opbal_data

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can also use thi s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: NAMES(30)    TYPE C VALUE 'Charly, John , Peter', 
      NAMES2       TYPE STRING, 
      ONE(10)      TYPE C, 
      TWO(10)      TYPE C, 
      THREE        TYPE STRING, 
      FOUR(4)      TYPE C VALUE 'FOUR', 
      DELIMITER(2) VALUE ','. 

SPLIT NAMES AT DELIMITER INTO ONE TWO. 
*     ONE contains 'Charly' and TWO contains 'John , Pet'. 
*     SY-SUBRC is 4, because TWO was not large enough to 
*     accommodate the whole of the remaining string 
SPLIT NAMES AT ',' INTO ONE TWO THREE. 
*     ONE contains 'Charly', TWO contains ' John', 
*     THREE contains ' Peter'. 
SPLIT NAMES AT ', ' INTO ONE THREE TWO. 
*     ONE contains 'Charly', THREE contains 'John', 
*     TWO contains 'Peter'. 
CONCATENATE NAMES '' INTO NAMES2 SEPARATED BY SPACE. 
SPLIT NAMES2 AT DELIMITER INTO ONE TWO THREE FOUR. 
*     ONE contains 'Charly', TWO contains 'John', 
*     THREE contains 'Peter ', FOUR is empty. 
SPLIT NAMES2 AT DELIMITER INTO ONE FOUR THREE. 
*     ONE contains 'Charly', FOUR contains 'John', 
*     THREE contains 'Peter', SY-SUBRC is 4, since 
*     FOUR was not large enough (spaces are significant 
*     characters!) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:31:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538472#M576555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a string with a space in between?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538473#M576556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for your replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use the search functionality here to determine the length of the first word before the space?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example lets suppose the string is 'Uzbekistan Russia USA' how can I use the search or any other functionality to determine the length of Uzbekistan? I cannot use a constant number and I have to dynamically calculate for each string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With best regards,&lt;/P&gt;&lt;P&gt;Ketan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 07:36:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-split-a-string-with-a-space-in-between/m-p/2538473#M576556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T07:36:17Z</dc:date>
    </item>
  </channel>
</rss>

