<?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 table to excel in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096703#M1182863</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;If you want to Format the excel sheet then need to write the OLE for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to this link..&lt;/P&gt;&lt;P&gt;[EXCEL using OLE|http://sapnet.ru/viewforum.php?f=9]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avinash Kodarapu on Feb 2, 2009 8:28 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Feb 2009 02:53:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-02T02:53:56Z</dc:date>
    <item>
      <title>download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096702#M1182862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wanting to download a table from SAP into excel, all i need to be able to do is make the first line bold, manually set the column widths and maybe draw lines around each cell (can live without this requirement though)! Would be very grateful if anyone could tell me easiest way to code this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 21:14:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096702#M1182862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T21:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096703#M1182863</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;If you want to Format the excel sheet then need to write the OLE for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to this link..&lt;/P&gt;&lt;P&gt;[EXCEL using OLE|http://sapnet.ru/viewforum.php?f=9]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avinash Kodarapu on Feb 2, 2009 8:28 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 02:53:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096703#M1182863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T02:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096704#M1182864</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;I think this can be done if you write a report that &lt;/P&gt;&lt;P&gt;1. read the data from the table into an internal table having structure excatly same fields/fields required to download&lt;/P&gt;&lt;P&gt;2.Simply use the GUI_DOWNLOAD FM giving the name of the internal table and format as 'ASC',just mention the name of the excel file with file pathname.&lt;/P&gt;&lt;P&gt;3.Save it,activate the code and simply run it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding a code snnipet for better understanding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : RF02K,LFA1.&amp;lt;name of the table to be download&amp;gt;

"declaration f the structure
&amp;lt;mention all the fields required to download&amp;gt;
DATA : BEGIN OF ITAB1 OCCURS 0,
      NR LIKE RF02K-LIFNR,
       KK LIKE RF02K-KTOKK,
       E1 LIKE LFA1-NAME1,
       TL LIKE LFA1-SORTL,
       D1 LIKE LFA1-LAND1,
       AS LIKE LFA1-SPRAS,
       END OF ITAB1.

start-of-selection.
"Read the record from the table into the internal table
SELECT B~LIFNR B~KTOKK B~NAME1 B~SORTL B~LAND1 B~SPRAS FROM LFA1 AS B  INTO TABLE ITAB1.

"simply call the FM 
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
"fiel name with extension .xls,where data from teh internal table to be downloaded
   FILENAME                      = 'C:\Documents and Settings\pmittal\Desktop\BOOK2.xls' 
   FILETYPE                      = 'ASC' 
*   HAS_FIELD_SEPARATOR           = ' '
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  TABLES
    DATA_TAB                      = ITAB1."name of the intrenal table
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   NO_AUTHORITY                  = 6
*   UNKNOWN_ERROR                 = 7
*   BAD_DATA_FORMAT               = 8
*   HEADER_NOT_ALLOWED            = 9
*   SEPARATOR_NOT_ALLOWED         = 10
*   HEADER_TOO_LONG               = 11
*   UNKNOWN_DP_ERROR              = 12
*   ACCESS_DENIED                 = 13
*   DP_OUT_OF_MEMORY              = 14
*   DISK_FULL                     = 15
*   DP_TIMEOUT                    = 16
*   OTHERS                        = 17
          .
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.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 03:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096704#M1182864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T03:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096705#M1182865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Write Header&lt;/P&gt;&lt;P&gt;    CALL METHOD cl_gui_frontend_services=&amp;gt;gui_download&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = v_fullpath&lt;/P&gt;&lt;P&gt;        filetype                = 'ASC'&lt;/P&gt;&lt;P&gt;        write_field_separator   = 'X'&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        data_tab                = it_header                   "header fields&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;        not_supported_by_gui    = 22&lt;/P&gt;&lt;P&gt;        error_no_gui            = 23&lt;/P&gt;&lt;P&gt;        OTHERS                  = 24.&lt;/P&gt;&lt;P&gt;&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;&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;&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;*Save File&lt;/P&gt;&lt;P&gt;    CALL METHOD cl_gui_frontend_services=&amp;gt;gui_download&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = v_fullpath&lt;/P&gt;&lt;P&gt;        filetype                = 'ASC'&lt;/P&gt;&lt;P&gt;        write_field_separator   = 'X'&lt;/P&gt;&lt;P&gt;        append                  = 'X'&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        data_tab                = it_mstrings                  "the records&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;        not_supported_by_gui    = 22&lt;/P&gt;&lt;P&gt;        error_no_gui            = 23&lt;/P&gt;&lt;P&gt;        OTHERS                  = 24.&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;&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;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:02:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096705#M1182865</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096706#M1182866</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;check this thread&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="261465"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Aakash Banga&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:04:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096706#M1182866</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096707#M1182867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mart,&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;  As ur requirment needed,check the following website which may help u..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    [http://abaplovers.blogspot.com/2008/05/abap-internal-table-to-excel-sheet.html]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Annevit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096707#M1182867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096708#M1182868</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;Do it through the report programming. fetch the value from table to report and &lt;/P&gt;&lt;P&gt;try out the following program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;orm download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-ucomm = 'DOWNLOAD' and sy-lsind = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    data: fullpath      type string,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        filename      type string,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        path          type string,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        user_action   type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        encoding      type abap_encoding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method cl_gui_frontend_services=&amp;gt;file_save_dialog&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        window_title         = 'Gui_Download Demo'&lt;/P&gt;&lt;P&gt;        with_encoding        = 'X'&lt;/P&gt;&lt;P&gt;        initial_directory    = 'C:\'&lt;/P&gt;&lt;P&gt;      changing&lt;/P&gt;&lt;P&gt;        filename             = filename&lt;/P&gt;&lt;P&gt;        path                 = path&lt;/P&gt;&lt;P&gt;        fullpath             = fullpath&lt;/P&gt;&lt;P&gt;        user_action          = user_action&lt;/P&gt;&lt;P&gt;        file_encoding        = encoding&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;        cntl_error           = 1&lt;/P&gt;&lt;P&gt;        error_no_gui         = 2&lt;/P&gt;&lt;P&gt;        not_supported_by_gui = 3&lt;/P&gt;&lt;P&gt;        others               = 4.&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;&lt;/P&gt;&lt;P&gt;      exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if user_action &amp;lt;&amp;gt; cl_gui_frontend_services=&amp;gt;action_ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rajesh Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:56:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096708#M1182868</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096709#M1182869</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;The following OLE program will help u to achieve ur requirement. U can set Font , Color and etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* this report demonstrates how to send some ABAP data to an
* EXCEL sheet using OLE automation.
include ole2incl.
* handles for OLE objects
data: h_excel type ole2_object,        " Excel object
      h_mapl type ole2_object,         " list of workbooks
      h_map type ole2_object,          " workbook
      h_zl type ole2_object,
      d_interior type ole2_object,          " cell
      h_f type ole2_object,
workbook type ole2_object,
sheet type ole2_object,
cell type ole2_object,
cell1 type ole2_object,
column type ole2_object,
range type ole2_object,
borders type ole2_object,
button type ole2_object,
int type ole2_object,
font type ole2_object,
row type ole2_object..            " font
tables: spfli.
data  h type i.
* table of flights
data: it_spfli like spfli occurs 10 with header line.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;   Event START-OF-SELECTION
*&amp;amp;---------------------------------------------------------------------*
start-of-selection.

  select * from spfli into table it_spfli up to 10 rows.
* display header
*
  create object h_excel 'EXCEL.APPLICATION'.
*
 SET PROPERTY OF H_EXCEL  'Visible' = 0.
**
  call method of h_excel 'Workbooks' = h_mapl.

** add a new workbook
  call method of h_mapl 'Add' = h_map.

* output column headings to active Excel sheet
  perform fill_cell using 1 1 1 'Airline'.
  perform fill_cell using 1 2 1 'Flight No'.
  perform fill_cell using 1 3 1 'Country'.
  perform fill_cell using 1 4 1 'Departure City'.
  perform fill_cell using 1 5 1 'Arrival City'.

* copy flights to active EXCEL sheet
  loop at it_spfli.
    h = sy-tabix + 1.
    perform fill_cell using h 1 0 it_spfli-carrid.
    perform fill_cell using h 2 0 it_spfli-connid.
    perform fill_cell using h 3 0 it_spfli-countryfr.
    perform fill_cell using h 4 0 it_spfli-cityfrom.
    perform fill_cell using h 5 0 it_spfli-cityto.

  endloop.

  perform save_book.
  perform err_hdl.
*---------------------------------------------------------------------*
*       FORM FILL_CELL                                                
*---------------------------------------------------------------------*
*       sets cell at coordinates i,j to value val boldtype bold       
*---------------------------------------------------------------------*
form fill_cell using i j bold val.
  call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
  set property of h_zl 'Value' = val .
  get property of h_zl 'Font' = h_f.
  set property of h_f 'Bold' = bold .
  if i = 1.
  get property of h_zl 'Interior' = d_interior .
  set property of d_interior 'ColorIndex' = 3.
   endif.
endform.
*&amp;amp;---------------------------------------------------------------------*
*F56E451208D111AB09006
*&amp;amp;---------------------------------------------------------------------*
*       outputs OLE error if any                                       
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form err_hdl.
if sy-subrc &amp;lt;&amp;gt; 0.
  write: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
endif.
endform.                    " ERR_HDL

form save_book.
  data: p_file type rlgrap-filename.
 p_file = 'C:\Customerdata2.xls'.
*get property of h_excel 'ActiveSheet' = sheet.
*free object sheet.
*free object workbook.
get property of h_excel 'ActiveWorkbook' = h_mapl.
call method of h_mapl 'SAVEAS' exporting #1 = p_file #2 = 1.
call method of h_mapl 'CLOSE'.
call method of h_excel 'QUIT'.
free object sheet.
free object h_mapl.
free object h_excel.
endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 05:07:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096709#M1182869</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T05:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096710#M1182870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi dude,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just go and check the standard program RSDEMO01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Customize it to your needs..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 08:16:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096710#M1182870</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-02-02T08:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: download table to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096711#M1182871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent thanks for the replies thats great. Have now managed to create an excel spreadsheet using OLE which downloads the table, sets heading to bold and auto fits the colums. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the following command to autofit the table columns but was just wondering if anyone knows if it is possible to set a specific width for a specific column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD OF application 'Columns' = COLUMN.&lt;/P&gt;&lt;P&gt;  CALL METHOD OF COLUMN 'Autofit'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Also does anyone know how to set a cell or range of cells to wrap its text? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 14:32:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/download-table-to-excel/m-p/5096711#M1182871</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T14:32:51Z</dc:date>
    </item>
  </channel>
</rss>

