Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Exporting to Excel using MS_EXCEL_OLE_STANDARD_DAT

$
0
0

Greetings!

 

I am attempting to export data from an internal table in a custom program to Microsoft Excel.  I have a call to the standard FM MS_EXCEL_OLE_STANDARD_DAT.  I am passing 2 internal tables and a path where I would like to save to.  The contents of the table are coming through just fine in DATA_TAB and being populated in the Excel file, but when I try to pass FIELDNAMES as a table full of character strings with the titles of the fields, I get an error.  When the program comes to a field whose contents are numerical (but whose header is of course still a string) it causes an error.  Could anyone give me guidance as to how to send fieldnames to this FM so that it will populate the header and not cause an error?  The tables I am exporting are tables without header lines.  See excerpts of my code below. 

I would appreciate any help I could get on this matter.

 

 

TYPES: BEGIN OF t_title_no_header,
      title(20),
      END OF t_title_no_header.

 

 

DATA:  i_title_no_header TYPE TABLE OF t_title_no_header,
            w_title_no_header TYPE t_title_no_header.

 

 

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'         "D60K900716   "TJC
                EXPORTING
                  file_name                 = v_path
                  data_sheet_name           = 'Data'

                TABLES
                  data_tab                  = i_report_no_header     "TJC
                  fieldnames                = i_title_no_header    "TJC

                EXCEPTIONS
                      file_write_error        = 1                  "TJC
                      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.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>