08-03-2011 8:19 AM
Hello
I want to output a internal table to an excel file.
Now I open an existing file and write data into it.
Then I have 2 problems: one is how can I save it without prompt a confirm dialog for overwrite the existing file; the other is now the excel is running backgroud, and I want it to be viewable to the user after all the data is output, how to do?.
08-03-2011 9:36 AM
I hope you are using the DOI functionality by the classes, I_OI_DOCUMENT_PROXY and I_OI_SPREADSHEET_INTERFACE.
Then in such a case
To save the document without prompting the user
I_OI_DOCUMENT_PROXY->save_as
EXPORTING
file_name = file_name
prompt_user = prompt_user " Leave it blank to avoid the Prompt
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
To Display the excel,
I_OI_DOCUMENT_PROXY->OPEN_DOCUMENT
EXPORTING
DOCUMENT_TITLE =
DOCUMENT_URL =
NO_FLUSH =
OPEN_INPLACE = " For this you need to create a custom container in the module pool
OPEN_READONLY =
PROTECT_DOCUMENT =
ONSAVE_MACRO =
STARTUP_MACRO =
USER_INFO =
IMPORTING
ERROR =
RETCODE =
Hope this helps
Cheers!!
-Mishra
08-03-2011 4:32 PM
Hi Lupin Rabbit,
about running DOI in background, is like running OLE in background, the question has been asked one hundred times, the answer is that it's impossible (unless you install a server with MS Office/SAP GUI installed, and things like that), and that the easiest workaround to generate Excel files in background is to use CSV or XML or XLSX (using especially abap2xlsx tool -> SDN Code Exchange) format depending on the minimum target Excel release instead of DOI/OLE.
BR
Sandra