<?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 Manipulating Long Text Strings in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924974#M59662</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;I have a program which takes a string and creates a BW Document.  The BW Document's contents is the contents of the string.  I run into a problem if the string is greater than 1,022 characters because 1,022 is the max length of line in SDOKCNTASC.  So, I am trying to add code which checks if the string is longer than 1,022.  If so, then put the first 1,022 characters into line one of itab.  Keep looping until the remainder of the string is less than 1,022.  Then put that last piece of the string in the table.  When I run my code below, only the first 1,022 characters end up in the doc.  When I loop at itab, only one line comes out.  I am absolutely positive that my initial string is greater than 1,022.  In fact, it's exactly 1,355 characters.  Can someone please review my code and tell me what I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS SOOO MUCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: itab like SDOKCNTASC OCCURS 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    orig_text_len = strlen( text ).&lt;/P&gt;&lt;P&gt;    text_len = orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH ITAB.&lt;/P&gt;&lt;P&gt;    iteration = 1.&lt;/P&gt;&lt;P&gt;    need_to_inc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WHILE text_len &amp;gt; 1022.&lt;/P&gt;&lt;P&gt;      i_text = text+0(1022).&lt;/P&gt;&lt;P&gt;      SHIFT text BY 1022 PLACES.&lt;/P&gt;&lt;P&gt;      CONDENSE text.&lt;/P&gt;&lt;P&gt;      INSERT i_text INTO ITAB INDEX iteration.&lt;/P&gt;&lt;P&gt;      WRITE: / 'i_text: ', i_text.&lt;/P&gt;&lt;P&gt;      WRITE: / 'text: ', text.&lt;/P&gt;&lt;P&gt;      text_len = strlen( text ).&lt;/P&gt;&lt;P&gt;      WRITE: / 'text_len: ', text_len.&lt;/P&gt;&lt;P&gt;      iteration = iteration + 1.&lt;/P&gt;&lt;P&gt;      need_to_inc = 1.&lt;/P&gt;&lt;P&gt;    ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF need_to_inc = 1.&lt;/P&gt;&lt;P&gt;      iteration = iteration + 1.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WRITE: / 'text: ', text.&lt;/P&gt;&lt;P&gt;    INSERT text INTO ITAB INDEX iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT itab INTO wa.&lt;/P&gt;&lt;P&gt;      WRITE: / 'wa: ', wa.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WRITE: / 'orig_text_len: ', orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    len = strlen( filename ) - 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH l_t_chavl.&lt;/P&gt;&lt;P&gt;    l_s_chavl-chanm = p_objn.&lt;/P&gt;&lt;P&gt;    l_s_chavl-chavl = filename+0(len).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    l_s_content_info-mimetype = 'application/html'.&lt;/P&gt;&lt;P&gt;    l_s_content_info-file_name = filename.&lt;/P&gt;&lt;P&gt;    l_s_content_info-file_size = orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    name = filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR l_t_return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'RSOD_DOC_MAST_CHANGE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_chanm = l_s_chavl-chanm&lt;/P&gt;&lt;P&gt;        i_chavl = l_s_chavl-chavl&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_DOC_TYPE =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        i_description = descr&lt;/P&gt;&lt;P&gt;        i_name = name&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_LANGU = SY-LANGU&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        i_overwrite_mode = if_rsod_const=&amp;gt;mode_replace_phio&lt;/P&gt;&lt;P&gt;        i_with_content = 'X'&lt;/P&gt;&lt;P&gt;        i_s_content_info = l_s_content_info&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_WITH_URL =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_URL =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_COPY_URL_CONTENT =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      E_NAME =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        e_s_return = l_t_return&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        i_t_file_content_ascii = itab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      i_t_file_content_binary =.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF l_t_return-type = 'E' OR&lt;/P&gt;&lt;P&gt;       l_t_return-type = 'W' OR&lt;/P&gt;&lt;P&gt;       l_t_return-type = 'A'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  error&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      WRITE: / '**Error: Unable to create BW Document. ', filename,&lt;/P&gt;&lt;P&gt;'failed in call to function RSOD_DOC_MAST_CHANGE'.&lt;/P&gt;&lt;P&gt;      STOP.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  successfuly loaded&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      WRITE: / filename, 'Successfully Loaded'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 May 2005 15:59:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-05-17T15:59:34Z</dc:date>
    <item>
      <title>Manipulating Long Text Strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924974#M59662</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;I have a program which takes a string and creates a BW Document.  The BW Document's contents is the contents of the string.  I run into a problem if the string is greater than 1,022 characters because 1,022 is the max length of line in SDOKCNTASC.  So, I am trying to add code which checks if the string is longer than 1,022.  If so, then put the first 1,022 characters into line one of itab.  Keep looping until the remainder of the string is less than 1,022.  Then put that last piece of the string in the table.  When I run my code below, only the first 1,022 characters end up in the doc.  When I loop at itab, only one line comes out.  I am absolutely positive that my initial string is greater than 1,022.  In fact, it's exactly 1,355 characters.  Can someone please review my code and tell me what I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS SOOO MUCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DATA: itab like SDOKCNTASC OCCURS 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    orig_text_len = strlen( text ).&lt;/P&gt;&lt;P&gt;    text_len = orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH ITAB.&lt;/P&gt;&lt;P&gt;    iteration = 1.&lt;/P&gt;&lt;P&gt;    need_to_inc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WHILE text_len &amp;gt; 1022.&lt;/P&gt;&lt;P&gt;      i_text = text+0(1022).&lt;/P&gt;&lt;P&gt;      SHIFT text BY 1022 PLACES.&lt;/P&gt;&lt;P&gt;      CONDENSE text.&lt;/P&gt;&lt;P&gt;      INSERT i_text INTO ITAB INDEX iteration.&lt;/P&gt;&lt;P&gt;      WRITE: / 'i_text: ', i_text.&lt;/P&gt;&lt;P&gt;      WRITE: / 'text: ', text.&lt;/P&gt;&lt;P&gt;      text_len = strlen( text ).&lt;/P&gt;&lt;P&gt;      WRITE: / 'text_len: ', text_len.&lt;/P&gt;&lt;P&gt;      iteration = iteration + 1.&lt;/P&gt;&lt;P&gt;      need_to_inc = 1.&lt;/P&gt;&lt;P&gt;    ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF need_to_inc = 1.&lt;/P&gt;&lt;P&gt;      iteration = iteration + 1.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WRITE: / 'text: ', text.&lt;/P&gt;&lt;P&gt;    INSERT text INTO ITAB INDEX iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT itab INTO wa.&lt;/P&gt;&lt;P&gt;      WRITE: / 'wa: ', wa.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WRITE: / 'orig_text_len: ', orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    len = strlen( filename ) - 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH l_t_chavl.&lt;/P&gt;&lt;P&gt;    l_s_chavl-chanm = p_objn.&lt;/P&gt;&lt;P&gt;    l_s_chavl-chavl = filename+0(len).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    l_s_content_info-mimetype = 'application/html'.&lt;/P&gt;&lt;P&gt;    l_s_content_info-file_name = filename.&lt;/P&gt;&lt;P&gt;    l_s_content_info-file_size = orig_text_len.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    name = filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR l_t_return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'RSOD_DOC_MAST_CHANGE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_chanm = l_s_chavl-chanm&lt;/P&gt;&lt;P&gt;        i_chavl = l_s_chavl-chavl&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_DOC_TYPE =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        i_description = descr&lt;/P&gt;&lt;P&gt;        i_name = name&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_LANGU = SY-LANGU&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        i_overwrite_mode = if_rsod_const=&amp;gt;mode_replace_phio&lt;/P&gt;&lt;P&gt;        i_with_content = 'X'&lt;/P&gt;&lt;P&gt;        i_s_content_info = l_s_content_info&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_WITH_URL =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_URL =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I_COPY_URL_CONTENT =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      E_NAME =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        e_s_return = l_t_return&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        i_t_file_content_ascii = itab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      i_t_file_content_binary =.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF l_t_return-type = 'E' OR&lt;/P&gt;&lt;P&gt;       l_t_return-type = 'W' OR&lt;/P&gt;&lt;P&gt;       l_t_return-type = 'A'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  error&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      WRITE: / '**Error: Unable to create BW Document. ', filename,&lt;/P&gt;&lt;P&gt;'failed in call to function RSOD_DOC_MAST_CHANGE'.&lt;/P&gt;&lt;P&gt;      STOP.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  successfuly loaded&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      WRITE: / filename, 'Successfully Loaded'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2005 15:59:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924974#M59662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-17T15:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Long Text Strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924975#M59663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this always happens... i post a question, then i play with the program some more and i end up solving my problem...  let me test it out and if i need further help, i will post another topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2005 16:26:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924975#M59663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-17T16:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Long Text Strings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924976#M59664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Audrey:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is with the place where you have coded initialization and incrementation of counters that you are using. Do following 2 steps and you will be ok:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Inside the while loop of "WHILE text_len &amp;gt; 1022", remove the code "iteration = iteration + 1" and place it directly after the WHILE statement; i.e. make it the first statement within the WHILE loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Just outside the WHILE loop, initialize "iteration" variable to zero (and not 1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will solve your problem. What was happening is that while adding the last record to internal table, the program was skipping one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iteration = 0.     &amp;lt;======== (set it to zero, and not 1)&lt;/P&gt;&lt;P&gt;need_to_inc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE text_len &amp;gt; 1022.&lt;/P&gt;&lt;P&gt;  iteration = iteration + 1.  &amp;lt;===== add statement here&lt;/P&gt;&lt;P&gt;  i_text = text+0(1022).&lt;/P&gt;&lt;P&gt;  SHIFT text BY 1022 PLACES.&lt;/P&gt;&lt;P&gt;  CONDENSE text.&lt;/P&gt;&lt;P&gt;  INSERT i_text INTO itab INDEX iteration.&lt;/P&gt;&lt;P&gt;  WRITE: / 'i_text: ', i_text.&lt;/P&gt;&lt;P&gt;  WRITE: / 'text: ', text.&lt;/P&gt;&lt;P&gt;  text_len = STRLEN( text ).&lt;/P&gt;&lt;P&gt;  WRITE: / 'text_len: ', text_len.&lt;/P&gt;&lt;P&gt;  need_to_inc = 1.&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2005 16:49:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-long-text-strings/m-p/924976#M59664</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-17T16:49:31Z</dc:date>
    </item>
  </channel>
</rss>

