Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting to Excel using MS_EXCEL_OLE_STANDARD_DAT

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Todd,

Please check OSS Note 721793

https://service.sap.com/sap/support/notes/721793

This particular FM is not released for customer use.

Other FMs which can be used are mentioned in the Note.

Regards,

Nisha Vengal.

2 REPLIES 2

Former Member
0 Kudos

Hi Todd,

Please check OSS Note 721793

https://service.sap.com/sap/support/notes/721793

This particular FM is not released for customer use.

Other FMs which can be used are mentioned in the Note.

Regards,

Nisha Vengal.

0 Kudos

Thank you Nisha.  I used XXL_FULL_API and was able to have full functionality plus some nice extras in my Excel export.  The transition took some extra effort because XXL_FULL_API requires quite a bit more information to be passed, but it was worth the extra time and effort to get my report up and running better than ever.