<?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: Spliting internal table into multiple files in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748259#M1582454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;loop on yourtable.&lt;/P&gt;&lt;P&gt;younewtable1-col = yourtable-col1&lt;/P&gt;&lt;P&gt;append younewtable1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;younewtable2-col = yourtable-col2&lt;/P&gt;&lt;P&gt;append younewtable2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;younewtable3-col = yourtable-col3&lt;/P&gt;&lt;P&gt;append younewtable3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if there are more col...better to use field symbols.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Mar 2011 09:32:35 GMT</pubDate>
    <dc:creator>piyush_mathur</dc:creator>
    <dc:date>2011-03-15T09:32:35Z</dc:date>
    <item>
      <title>Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748255#M1582450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, i have a quick question and im new in abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say i have an internal table gt_output and it has 10 fields and each fields are filled with weekly data.lets say i have 5 rows of data. how  do i split the column/fields so that every field can become one text file? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:10:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748255#M1582450</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T09:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748256#M1582451</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;Create two new tables with the fields.&lt;/P&gt;&lt;P&gt;Loop on main table and append corresponding fields from main to other tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748256#M1582451</guid>
      <dc:creator>sandip_panchal</dc:creator>
      <dc:date>2011-03-15T09:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748257#M1582452</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;well if i understood correctly, you have data in one table and you want to download data in diff files for each week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Are you downloading it on PC or UNIX&lt;/P&gt;&lt;P&gt;2) Do one thing....&lt;/P&gt;&lt;P&gt;For example: You have Below table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COL1     COL2    COL3&lt;/P&gt;&lt;P&gt;1WK       X            Y&lt;/P&gt;&lt;P&gt;1WK       X1          Y1&lt;/P&gt;&lt;P&gt;2WK       X2          Y2&lt;/P&gt;&lt;P&gt;3WK       X            Y&lt;/P&gt;&lt;P&gt;CREATE ANOTHER TABLE WITH SAME STRUCTURE&lt;/P&gt;&lt;P&gt;LOOP ON YOUR TABLE.&lt;/P&gt;&lt;P&gt;ON CHANGE OF COL1.&lt;/P&gt;&lt;P&gt;YOURNEWTABLE = MAINTABLE&lt;/P&gt;&lt;P&gt;DELETE YOURNEWTABLE WHERE COL1 NE YOURMAINTABLE-COL1&lt;/P&gt;&lt;P&gt;****NOW YOU WILL HAVE ONLY 1WK DATA IN YOURNEWTABLE&lt;/P&gt;&lt;P&gt;DOWNLOAD THE YOURNEWTABLE.&lt;/P&gt;&lt;P&gt;****IN 2ND LOOK, YOU WILL GET 2WK DATE, AND NEXT 3 WK DATA SO ON&lt;/P&gt;&lt;P&gt;ENDON.&lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br,&lt;/P&gt;&lt;P&gt;Piyush&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748257#M1582452</guid>
      <dc:creator>piyush_mathur</dc:creator>
      <dc:date>2011-03-15T09:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748258#M1582453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;lets say i have 10 fields in an internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;column       c1  c2  c3  c4  c5  c6  c7  c8  c9  c10&lt;/P&gt;&lt;P&gt;row1           1   2    3    4    5    6    7    8    9    10 &lt;/P&gt;&lt;P&gt;row2          11  12   13 14  15  16  17  18  19  20.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my requirement is to convert every column into a file..so thats means i will have 10 text file with 2 rows of data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:23:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748258#M1582453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T09:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748259#M1582454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;loop on yourtable.&lt;/P&gt;&lt;P&gt;younewtable1-col = yourtable-col1&lt;/P&gt;&lt;P&gt;append younewtable1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;younewtable2-col = yourtable-col2&lt;/P&gt;&lt;P&gt;append younewtable2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;younewtable3-col = yourtable-col3&lt;/P&gt;&lt;P&gt;append younewtable3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if there are more col...better to use field symbols.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:32:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748259#M1582454</guid>
      <dc:creator>piyush_mathur</dc:creator>
      <dc:date>2011-03-15T09:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748260#M1582455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So if you're internal table has 10 columns, you need 10 files. If you have 50 columns you need 50 files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a possible soultion would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: gt_string type table of string.
data: wa_string type string.
data: gv_file type string.

field-symbols: &amp;lt;fs_field&amp;gt; type any.

loop at gt_output into wa_output.
  do.
    assign component sy-index of structure wa_output to &amp;lt;fs_field&amp;gt;.
    if sy-subrc ne 0.
      exit.
    endif.

    concatenate 'c:\file_' sy-index '.txt' into gv_file.
    
    wa_string = &amp;lt;fs_field&amp;gt;.

    clear gt_string[].
    append wa_string to gt_string.
    
    call method cl_gui_frontend_services=&amp;gt;gui_download
      exporting
        filename                = gv_file
        append                  = 'X'
        filetype                = 'ASC'
      changing
        data_tab                = gt_string[]
      exceptions
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        not_supported_by_gui    = 22
        error_no_gui            = 23
        others                  = 24.
    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.
    endif.
   
  enddo.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:36:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748260#M1582455</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T09:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748261#M1582456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in my requirement i have 82 columns..so i will need to split to 82 internal tables?&lt;/P&gt;&lt;P&gt;how to use field symbol? care to clarify?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 09:37:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748261#M1582456</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T09:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748262#M1582457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually i still dont understand..it's helpful though..but how to assign the field symbol so that all the rows in the collumn included into 1 file? and next column with rows in another file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 10:00:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748262#M1582457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T10:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748263#M1582458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;assign component sy-index of structure wa_output to &amp;lt;fs_field&amp;gt;.
    if sy-subrc ne 0.
      exit.
    endif.
 
    concatenate 'c:\file_' sy-index '.txt' into gv_file.
    
    wa_string = &amp;lt;fs_field&amp;gt;.
 
    clear gt_string[].
    append wa_string to gt_string.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, each column value is captured in an internal table. And that internal table always hold one single record: the value of the column assigned to the field-symbol. And the content of that internal table is APPENDED to a file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, each column will get its own filename:&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;concatenate 'c:\file_' sy-index '.txt' into gv_file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you have 2 columns and 2 rows like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;C1 C2&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;C D&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then during the LOOP&lt;/P&gt;&lt;P&gt;on the first record: &lt;/P&gt;&lt;P&gt;1. value A is appended to file 'c:\file_1.txt&lt;/P&gt;&lt;P&gt;2. value B is appended to file 'c:\file_2.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on the second record&lt;/P&gt;&lt;P&gt;1. value C is  appended  to file 'c:\file_1.txt&lt;/P&gt;&lt;P&gt;2. value D is  appended  to file 'c:\file_2.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you understand now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 10:34:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748263#M1582458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T10:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748264#M1582459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;my bad..i accidently delete a few lines and it makes my program creating files for every field..i understand your program now its very helpful...&lt;/P&gt;&lt;P&gt;but i still dont understand how field symbol works as i now having a problem..im trying to format the string(text)  before &lt;/P&gt;&lt;P&gt;downloading them as a text file. i need to put header and then format them according to my requirement..i tried to change the field symbol, and also format them according according to my requirement...but no luck..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;column : matnr     wk01     wk02&lt;/P&gt;&lt;P&gt;rows   :    1234    1000       10001&lt;/P&gt;&lt;P&gt;                 1245    1099       1098&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file 1.&lt;/P&gt;&lt;P&gt;matnr     qty&lt;/P&gt;&lt;P&gt;1234     1000    &lt;/P&gt;&lt;P&gt;1245     1099&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file2.&lt;/P&gt;&lt;P&gt;matnr    qty&lt;/P&gt;&lt;P&gt;1234     10001&lt;/P&gt;&lt;P&gt;1245     1098&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my requirement is something like this..and i have almost 100 field/column in the internal table. so i will have almost 100 txt files.&lt;/P&gt;&lt;P&gt;do i need to create 100 internal table? how do i use field symbol?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you in advance..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 17:34:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748264#M1582459</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T17:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748265#M1582460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, regarding the field symbol, care to explain how to use it? i still haven;t had any clue how to program as per my requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 01:53:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748265#M1582460</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-16T01:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Spliting internal table into multiple files</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748266#M1582461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you guys.your tips are helpful.i have found the way already...i created global structure and use field symbol.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 09:07:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/spliting-internal-table-into-multiple-files/m-p/7748266#M1582461</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-17T09:07:24Z</dc:date>
    </item>
  </channel>
</rss>

