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

Former Member
0 Kudos

Hi everyboy!

I need to download some data with

CREATE OBJECT h_excel 'Excel.Application'.

SET PROPERTY OF h_excel 'Visible' = 1.

GET PROPERTY OF h_excel 'Workbooks' = h_map.

CALL METHOD OF h_map 'Workbooks' = h_map.

    • open existing workbook

call method of h_map 'Open' = rc

exporting #1 = p_file.

PERFORM err_hdl.

In p_file is my excel form (f.e. c:\Pool.xls)

But i can't open this excel form!

Please gimme some help (its urgent)

thanks

Thomas

4 REPLIES 4

franois_henrotte
Active Contributor
0 Kudos

I suggest that you use classes for Office integration in place of doing all this stuff by yourself

You can take a look at the sample program SAPRDEMOEXCELINTEGRATION2

Former Member
0 Kudos

Hi,

Try the Following

data: e_sheet type ole2_object.

data: e_appl type ole2_object.

data: e_work type ole2_object.

data: e_cell type ole2_object.

data: e_wbooklist type ole2_object.

parameters: p_file type localfile default 'C:\Test.xls'.

start-of-selection.

  • Start the application

create object e_appl 'EXCEL.APPLICATION'.

set property of e_appl 'VISIBLE' = 0.

  • Open the file

call method of e_appl 'WORKBOOKS' = e_wbooklist.

get property of e_wbooklist 'Application' = e_appl .

set property of e_appl 'SheetsInNewWorkbook' = 1 .

call method of e_wbooklist 'Add' = e_work .

get property of e_appl 'ActiveSheet' = e_sheet .

set property of e_sheet 'Name' = 'Test' .

Regards,

Lijo Joseph

Former Member
0 Kudos

Hi Lijo,

i tried your solution, but i always get the error message: "Fehler bei OLE-Automation: 2"

Wich means, the sy-subrc = 2.

Do you know why?

Best regards

Thomas

Former Member
0 Kudos

Hi

Check this tx DWDM, there u have many examples about integration ole.

Reward points

Regards

Gregory