<?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: String manipulation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513868#M236703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might try something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: begin of itab occurs 0,
      index type i,
      value(60) type c,
      end of itab.
data: offset type i.
data: len type i.
data: string type string.
data: substring type i.

string = 'This is the string that we need to break up into 60 ' &amp;amp;
         'characters per line and place the values in an internal' &amp;amp;
         ' table with a index value for each row that we add'.

len = strlen( string ).


do.

  if len &amp;lt; 0.
    exit.
  endif.

  if len &amp;lt; 60.
    substring = len.
    itab-index = sy-index.
    itab-value = string+offset(substring).
  else.
    itab-index = sy-index.
    itab-value = string+offset(60).
  endif.

  append itab.

  len = len - 60.
  offset = offset + 60.

enddo.

loop at itab.
  write:/ itab-index,  itab-value.
endloop.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Sep 2006 13:08:10 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-09-06T13:08:10Z</dc:date>
    <item>
      <title>String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513864#M236699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am obtaining a string from the database. I just wanna split that string into every 60 characters.I have to append it to the internal table.For every 60 characters i have to give the row value as 1 and it should increment depending upon the number of splits made.&lt;/P&gt;&lt;P&gt;Kindly help me in resolving this.Thanx in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Sep 2006 12:51:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513864#M236699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-06T12:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513865#M236700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the FM RKD_WORD_WRAP, Pass the string in the TEXTLINE and OUTPUTLEN = 60. You will get the splitted lines in the table OUT_LINES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TYPES: BEGIN OF ty_desc,&lt;/P&gt;&lt;P&gt;          desc TYPE char50,&lt;/P&gt;&lt;P&gt;         END OF ty_desc.&lt;/P&gt;&lt;P&gt;  DATA: li_desc TYPE STANDARD TABLE OF ty_desc,&lt;/P&gt;&lt;P&gt;        lwa_desc TYPE ty_desc,&lt;/P&gt;&lt;P&gt;        ws_data type char100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ws_data = 'sjkdc jsfjsfshf fjsfhjsd fjksd'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'RKD_WORD_WRAP'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      textline            = ws_data&lt;/P&gt;&lt;P&gt;      outputlen           = 50&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      out_lines           = li_desc&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      outputlen_too_large = 1&lt;/P&gt;&lt;P&gt;      OTHERS              = 2.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prakash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Sep 2006 12:57:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513865#M236700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-06T12:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513866#M236701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;put like this &lt;/P&gt;&lt;P&gt;l = strlen(itab-text).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 1 times.&lt;/P&gt;&lt;P&gt;n =  n + 1.&lt;/P&gt;&lt;P&gt;if n = 60.&lt;/P&gt;&lt;P&gt;here create a new line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is sample code only,but u can achive this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Sep 2006 12:58:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513866#M236701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-06T12:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513867#M236702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Satheesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A possible solution looks like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: begin of ty_s_entry.
TYPES: row  TYPE i.
TYPES: text TYPE char60.
TYPES: end of ty_s_entry.
data:
  ls_entry  TYPE ty_s_entry.


  DO.
    ls_entry-row  = syst-tabix.
    ls_entry-text = ld_string+0(60).

    IF ( ls_entry-text IS INITIAL ).
      EXIT.
    ENDIF.
    
    APPEND ls_entry TO lt_itab.
  ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not exactly know how you recognise the end of your string. Probably you have to define another condition.&lt;/P&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>Wed, 06 Sep 2006 13:01:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513867#M236702</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-06T13:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513868#M236703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might try something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: begin of itab occurs 0,
      index type i,
      value(60) type c,
      end of itab.
data: offset type i.
data: len type i.
data: string type string.
data: substring type i.

string = 'This is the string that we need to break up into 60 ' &amp;amp;
         'characters per line and place the values in an internal' &amp;amp;
         ' table with a index value for each row that we add'.

len = strlen( string ).


do.

  if len &amp;lt; 0.
    exit.
  endif.

  if len &amp;lt; 60.
    substring = len.
    itab-index = sy-index.
    itab-value = string+offset(substring).
  else.
    itab-index = sy-index.
    itab-value = string+offset(60).
  endif.

  append itab.

  len = len - 60.
  offset = offset + 60.

enddo.

loop at itab.
  write:/ itab-index,  itab-value.
endloop.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Sep 2006 13:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513868#M236703</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-09-06T13:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: String manipulation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513869#M236704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U can try the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lstr is the string having the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lrecord = lstr.&lt;/P&gt;&lt;P&gt;Do 100 Times.&lt;/P&gt;&lt;P&gt; clear itab-record.&lt;/P&gt;&lt;P&gt; itab-serial = sy-index.&lt;/P&gt;&lt;P&gt; itab-record = lrecord(60).&lt;/P&gt;&lt;P&gt; shift lrecord by 60 places.&lt;/P&gt;&lt;P&gt; if lrecord ne space.&lt;/P&gt;&lt;P&gt;    append itab-record.&lt;/P&gt;&lt;P&gt; else.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Anurag Bankley&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Sep 2006 13:11:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-manipulation/m-p/1513869#M236704</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-06T13:11:43Z</dc:date>
    </item>
  </channel>
</rss>

