<?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: download multiple table data using RTTI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372883#M1543205</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I need to download data from multiple tables in one go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By "one go" you mean to download couple internal tables with one GUI_DOWNLOAD fm call? If so, this would mean you need same number of files being generated and packed with i.e ZIP. Then you download this ZIP file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, all you need is to wrap table generation + data extraction + download in loop passing each time different tablename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Nov 2010 08:00:54 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2010-11-05T08:00:54Z</dc:date>
    <item>
      <title>download multiple table data using RTTI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372881#M1543203</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;Using RTTI, I am trying to download database table data dynamically. I have code that works fine for one table at a time. If I need to download data from multiple tables in one go. How can I  do this using RTTI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VG&lt;/P&gt;&lt;P&gt;My code is...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: go_struct TYPE REF TO cl_abap_structdescr,
            go_table TYPE REF TO cl_abap_tabledescr,
            gi_data type ref to data.

      FIELD-SYMBOLS: &amp;lt;gi_data&amp;gt; TYPE STANDARD TABLE.

* Dynamically getting the line type of the specified table
      go_struct ?= cl_abap_typedescr=&amp;gt;describe_by_name( v_tabname ) .
      TRY.
          CALL METHOD cl_abap_tabledescr=&amp;gt;create
            EXPORTING
              p_line_type  = go_struct
              p_table_kind = 'S'
            RECEIVING
              p_result     = go_table.
        CATCH cx_sy_table_creation .
*MESSAGE e000 WITH text-004.
      ENDTRY.
* creating internal table of table type just created
      CREATE DATA gi_data TYPE HANDLE go_table.
* Assigning the internal table to field symbol
      ASSIGN gi_data-&amp;gt;* TO &amp;lt;gi_data&amp;gt;.

** get the data into the internal table from db table
      SELECT * INTO TABLE &amp;lt;gi_data&amp;gt; FROM (v_tabname).


download....
 CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*      filename                = 'C:\test.txt'
      filename                = p_file1
      write_field_separator   = 'X'
    TABLES
        data_tab               = &amp;lt;gi_data&amp;gt;
    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
      OTHERS                  = 22.

  IF sy-subrc = 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Nov 5, 2010 9:42 AM - &lt;STRONG&gt;please use code tags&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Nov 2010 20:34:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372881#M1543203</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-03T20:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: download multiple table data using RTTI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372882#M1543204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: go_struct TYPE REF TO cl_abap_structdescr,
go_table TYPE REF TO cl_abap_tabledescr,
gi_data type ref to data.

FIELD-SYMBOLS: &amp;lt;gi_data&amp;gt; TYPE STANDARD TABLE.
LOOP AT GT_TAB_LIST INTO GS_TAB_LIST.
* Dynamically getting the line type of the specified table
go_struct ?= cl_abap_typedescr=&amp;gt;describe_by_name( GS_TAB_LIST-tabname ) .
TRY.
CALL METHOD cl_abap_tabledescr=&amp;gt;create
EXPORTING
p_line_type = go_struct
p_table_kind = 'S'
RECEIVING
p_result = go_table.
CATCH cx_sy_table_creation .
*MESSAGE e000 WITH text-004.
ENDTRY.
* creating internal table of table type just created
CREATE DATA gi_data TYPE HANDLE go_table.
* Assigning the internal table to field symbol
ASSIGN gi_data-&amp;gt;* TO &amp;lt;gi_data&amp;gt;.

** get the data into the internal table from db table
SELECT * INTO TABLE &amp;lt;gi_data&amp;gt; FROM ( GS_TAB_LIST-tabname ).

download....
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* filename = 'C:\test.txt'
filename = p_file1
write_field_separator = 'X'
TABLES
data_tab = &amp;lt;gi_data&amp;gt;
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
OTHERS = 22.

IF sy-subrc = 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 07:30:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372882#M1543204</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-05T07:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: download multiple table data using RTTI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372883#M1543205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I need to download data from multiple tables in one go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By "one go" you mean to download couple internal tables with one GUI_DOWNLOAD fm call? If so, this would mean you need same number of files being generated and packed with i.e ZIP. Then you download this ZIP file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, all you need is to wrap table generation + data extraction + download in loop passing each time different tablename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 08:00:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372883#M1543205</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-11-05T08:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: download multiple table data using RTTI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372884#M1543206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for the response. I shall look into it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 12:50:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-multiple-table-data-using-rtti/m-p/7372884#M1543206</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-05T12:50:56Z</dc:date>
    </item>
  </channel>
</rss>

