<?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 do we write header and item data to a file from program? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585322#M263925</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to write data from R/3 to flat file.It is in format of level1 - header&lt;/P&gt;&lt;P&gt;          level2 - items&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Sep 2006 11:08:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-26T11:08:50Z</dc:date>
    <item>
      <title>How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585322#M263925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to write data from R/3 to flat file.It is in format of level1 - header&lt;/P&gt;&lt;P&gt;          level2 - items&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 11:08:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585322#M263925</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-26T11:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585323#M263926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the GUI_DOWNLOAD FM.&lt;/P&gt;&lt;P&gt;Option1.&lt;/P&gt;&lt;P&gt;Download Header details into one Flat file and Item details into one flat file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option2.&lt;/P&gt;&lt;P&gt;Declare a data type like below:&lt;/P&gt;&lt;P&gt;data: begin of i_data occurs 0,&lt;/P&gt;&lt;P&gt;       column1 type char50,&lt;/P&gt;&lt;P&gt;       column2 type char50,&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       end of i_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at header.&lt;/P&gt;&lt;P&gt;*append header to i_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at item where item's = header-key.&lt;/P&gt;&lt;P&gt;*apppend item to i_data.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the GUI_DOWNLOAD FM to download the I_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_DOWNLOAD'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    filename                        =&lt;/P&gt;&lt;P&gt;                    'C:\Documents and Settings\P.Ramu\Desktop\RDI1.xls'&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    data_tab                        = i_data&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   file_write_error                = 1&lt;/P&gt;&lt;P&gt;   no_batch                        = 2&lt;/P&gt;&lt;P&gt;   gui_refuse_filetransfer         = 3&lt;/P&gt;&lt;P&gt;   invalid_type                    = 4&lt;/P&gt;&lt;P&gt;   no_authority                    = 5&lt;/P&gt;&lt;P&gt;   unknown_error                   = 6&lt;/P&gt;&lt;P&gt;   header_not_allowed              = 7&lt;/P&gt;&lt;P&gt;   separator_not_allowed           = 8&lt;/P&gt;&lt;P&gt;   filesize_not_allowed            = 9&lt;/P&gt;&lt;P&gt;   header_too_long                 = 10&lt;/P&gt;&lt;P&gt;   dp_error_create                 = 11&lt;/P&gt;&lt;P&gt;   dp_error_send                   = 12&lt;/P&gt;&lt;P&gt;   dp_error_write                  = 13&lt;/P&gt;&lt;P&gt;   unknown_dp_error                = 14&lt;/P&gt;&lt;P&gt;   access_denied                   = 15&lt;/P&gt;&lt;P&gt;   dp_out_of_memory                = 16&lt;/P&gt;&lt;P&gt;   disk_full                       = 17&lt;/P&gt;&lt;P&gt;   dp_timeout                      = 18&lt;/P&gt;&lt;P&gt;   file_not_found                  = 19&lt;/P&gt;&lt;P&gt;   dataprovider_exception          = 20&lt;/P&gt;&lt;P&gt;   control_flush_error             = 21&lt;/P&gt;&lt;P&gt;   OTHERS                          = 22&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&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;Message was edited by: Prakash Ramu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 11:11:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585323#M263926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-26T11:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585324#M263927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Adi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First create an internal table (IT_FINAL) with all fields of header(IT_HDR) and item(IT_ITM) and use the first field of IT_FINAL as an indicator to differentiate header &amp;amp; items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean, while appending the final tab with header items, assign '0' to the first field to indicate it as header and while you append the items use '1' in the first field so that they can be easily identified as items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is a code snippet&lt;/P&gt;&lt;P&gt;*--- Fill header &lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELD1  = '0'.&lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELD2  = header field value 1  &lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELDn  = header field value n&lt;/P&gt;&lt;P&gt;    append it_final.&lt;/P&gt;&lt;P&gt;    clear it_final.&lt;/P&gt;&lt;P&gt;*--- Fill items&lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELD1  = '1'.&lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELD2  = item field value 1  &lt;/P&gt;&lt;P&gt;    IT_FINAL-FIELDn  = item field value n&lt;/P&gt;&lt;P&gt;    append it_final.&lt;/P&gt;&lt;P&gt;    clear it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and ofcourse use GUI_DOWNLOAD to get it on a flat file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure this will help. Pl reward accordingly if it does &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Karthik Potharaju&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 11:20:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585324#M263927</guid>
      <dc:creator>former_member189629</dc:creator>
      <dc:date>2006-09-26T11:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585325#M263928</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;Declare an internal table with header and another with item fields.&lt;/P&gt;&lt;P&gt;declare another internal table (it_char)with a single field of character type with large size that can accomodate your header as well as item data say 500.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at it_header.
 at new it_header-field1.
  "append all header fields to it_char
 endat.
 read table it_item with key field.
  " append all item fields to it_char.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Download the table it_char using GUI_DOWNLOAD Function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Richa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 11:30:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585325#M263928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-26T11:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585326#M263929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through these links&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/8e/dbe92341c84242be2c7d3917f1c197/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/8e/dbe92341c84242be2c7d3917f1c197/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.ittoolbox.com/code/archives.asp?d=2285&amp;amp;a=s&amp;amp;i=10" target="test_blank"&gt;http://sap.ittoolbox.com/code/archives.asp?d=2285&amp;amp;a=s&amp;amp;i=10&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 12:10:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585326#M263929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-26T12:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do we write header and item data to a file from program?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585327#M263930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on how you wish to transfer the data...lets say want header data and than the corresponding item data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at iheader.&lt;/P&gt;&lt;P&gt;  move iheader data to itext.&lt;/P&gt;&lt;P&gt;  append itext.&lt;/P&gt;&lt;P&gt;  clear idetail.&lt;/P&gt;&lt;P&gt;  loop at idetail where key = iheader-key.&lt;/P&gt;&lt;P&gt;    move idetail data to itext.&lt;/P&gt;&lt;P&gt;    append itext.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'gui_download'&lt;/P&gt;&lt;P&gt; exporting&lt;/P&gt;&lt;P&gt;   filename = 'C:\test.txt'&lt;/P&gt;&lt;P&gt; tables&lt;/P&gt;&lt;P&gt;   data_tab = itext.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 12:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-we-write-header-and-item-data-to-a-file-from-program/m-p/1585327#M263930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-26T12:14:43Z</dc:date>
    </item>
  </channel>
</rss>

