<?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: How to populate an internal table from a string variable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705798#M1453090</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi Sangeetha, 
&amp;lt;li&amp;gt;Try this way. 
&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest_notepad.

DATA: BEGIN OF it_file OCCURS 0,
       data TYPE c LENGTH 255,
      END OF it_file.
DATA str     TYPE string.
DATA g_len   TYPE i.
DATA g_off   TYPE i.
DATA g_loops TYPE i.
CONCATENATE
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x'
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890y'
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890z'
'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789m'
INTO str SEPARATED BY space.

g_len   = STRLEN( str ).
g_loops = g_len / 255.

g_off = 1.
DO g_loops TIMES.
  IF g_loops NE sy-index.
    IF sy-index EQ 1.
      it_file-data = str+0(255).
    ELSE.
      it_file-data = str+g_off(255).
    ENDIF.
    APPEND it_file.
    CLEAR  it_file.
    g_off = sy-index * 255.
  ELSE.
    g_len = g_len - g_off.
    it_file-data = str+g_off(g_len).
    APPEND it_file.
    CLEAR  it_file.
  ENDIF.
ENDDO.
LOOP AT it_file.
  WRITE:/ it_file-data.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Mar 2010 02:14:09 GMT</pubDate>
    <dc:creator>venkat_o</dc:creator>
    <dc:date>2010-03-12T02:14:09Z</dc:date>
    <item>
      <title>How to populate an internal table from a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705797#M1453089</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;My internal table contains a field of length 255 characters. &lt;/P&gt;&lt;P&gt;I have a string variable. I need to populate the internal table from the string variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should I code for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sangeeta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 01:42:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705797#M1453089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-12T01:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate an internal table from a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705798#M1453090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi Sangeetha, 
&amp;lt;li&amp;gt;Try this way. 
&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest_notepad.

DATA: BEGIN OF it_file OCCURS 0,
       data TYPE c LENGTH 255,
      END OF it_file.
DATA str     TYPE string.
DATA g_len   TYPE i.
DATA g_off   TYPE i.
DATA g_loops TYPE i.
CONCATENATE
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x'
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890y'
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890z'
'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789m'
INTO str SEPARATED BY space.

g_len   = STRLEN( str ).
g_loops = g_len / 255.

g_off = 1.
DO g_loops TIMES.
  IF g_loops NE sy-index.
    IF sy-index EQ 1.
      it_file-data = str+0(255).
    ELSE.
      it_file-data = str+g_off(255).
    ENDIF.
    APPEND it_file.
    CLEAR  it_file.
    g_off = sy-index * 255.
  ELSE.
    g_len = g_len - g_off.
    it_file-data = str+g_off(g_len).
    APPEND it_file.
    CLEAR  it_file.
  ENDIF.
ENDDO.
LOOP AT it_file.
  WRITE:/ it_file-data.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 02:14:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705798#M1453090</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-03-12T02:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate an internal table from a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705799#M1453091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will solve your problem..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA VAR VALUE '/' .

split text1 at VAR into table it_text. " chops the string at '/' and puts sequentially in table it_text(field shud b char)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR USE FM..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF TABLE OCCURS 10 ,
STR(100),
  END OF TABLE.

DATA WA LIKE LINE OF TABLE.

CALL FUNCTION 'IQAPI_WORD_WRAP'
  EXPORTING
    TEXTLINE                  = 'sumit12sddadsadasd3456789'
*   DELIMITER                 = ' '
   OUTPUTLEN                 = 5               " this is the length of each peice --&amp;gt; give 255 in your case
* IMPORTING
*   OUT_LINE1                 =
*   OUT_LINE2                 =
*   OUT_LINE3                 =
 TABLES
   OUT_LINES                 = TABLE
* EXCEPTIONS
*   OUTPUTLEN_TOO_LARGE       = 1
*   OTHERS                    = 2
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sumit Nene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 03:28:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705799#M1453091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-12T03:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate an internal table from a string variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705800#M1453092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Concatenate all the fields you need move into the file seperated by space or comma into your string,&lt;/P&gt;&lt;P&gt;and then populate the string into your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 04:58:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-populate-an-internal-table-from-a-string-variable/m-p/6705800#M1453092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-12T04:58:41Z</dc:date>
    </item>
  </channel>
</rss>

