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: 

Excel by DOI

Former Member
0 Kudos

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?.

2 REPLIES 2

former_member212002
Active Contributor
0 Kudos

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

Sandra_Rossi
Active Contributor
0 Kudos

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