Application Development and Automation 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: 
Read only

ABAP/Excel: Method Save_as

Former Member
0 Likes
1,241

Dear all,

Does anyone have experience with the method Save_as of the document proxy.

Although I supply a filename as parameter the document name in Excel (in this case) is always the Document title under which the Document has been created initially.

Does anyone have a solution?

Kind regards,

John.

1 REPLY 1
Read only

thomas_jung
Developer Advocate
Developer Advocate
0 Likes
587

I have used it without the problem you mention. The following is the sample code from 46C:

****Save the document

call method document->save_as

exporting

file_name = item_url.

call method c_oi_errors=>show_message exporting type = 'E'.

I have also done it from OLE. If you have problems you might try that:

  • handles for OLE objects

data: h_excel type ole2_object, " Excel object

ole_books type ole2_object,

ole_databook type ole2_object.

  • start Excel

data: file_type type i.

file_type = '-4143'.

create object h_excel 'EXCEL.APPLICATION'.

set property of h_excel 'Visible' = 0.

call method of h_excel 'Workbooks' = ole_books.

call method of ole_books 'Open' = ole_databook

exporting #1 = i_source_file.

call method of ole_databook 'SaveAs'

exporting #1 = i_destination_file

#2 = file_type.

call method of h_excel 'Quit'.

free object ole_databook.

free object ole_books.

free object h_excel.

The SaveAS with OLE lets you choose a filetype. -4143 is native Excel. 44 is HTML and 46 is XML.