Skip to Content
0
Sep 12, 2007 at 10:38 AM

Generate and display excel file

1046 Views

Hi guys,

Is there a way to generate and display excel file in sapgui without the need of downloading the excel file to local directory first?

I found the following 2 ways of doing it, but both require me to download the generated xls file to local directory:

#1 way:

1. Generate the xls file using GUI_DOWNLOAD with the filename = 'c:\test.xls'.

2. Call fm SAP_STARTS_EXCEL and pass in the parameter i_filename = 'c:\test.xls'

#2 way:

1. Generate the xls file using GUI_DOWNLOAD with the filename = 'c:\test.xls'.

2. Upload it back using the below so that i can get it in xstring format.

CALL FUNCTION 'GUI_UPLOAD'

exporting

filetype = 'BIN'

filename = 'C:\test.xls'

tables

data_tab = itab.

3. Then pass it to the cl_gui_html_viewer to display it.

call method html_control->load_data

exporting

url = 'test.xls'

type = 'application'

subtype = 'vnd.ms-excel'

importing

assigned_url = l_url

changing

data_table = l_pdf_data

exceptions

others = 1.

I prefer the #2 way as my program will get wrapped thru ITS server, and it seems the #1 way will not work. So is there any way i can get the excel file to be generated in xstring format so that i can pass to cl_gui_html_viewer straight away to display without having to save to local directory first?

Any other suggestion apart from the above 2 ways are welcome as well.

Thanks guys.