Hello All,
I'm having a difficulting looking for a function module that can download an excel file with multiple worksheets.
For example, I need to retrieve from table TCURR the exchange rate for the day. Moreover, a separate sheet needs to be created or each base currency maintained. So if I have let's say 20 currencies that are being maintained, I need to create 20 worksheets for that and then save it to an excel file to a network folder.
I'd really appreciate your help on this. Thanks a lot in advance.
Regards,
Kristine
Hi Kristine,
Take a look at transaction DWDM (Demo programs) under tree-node "Demo's Workbench" --> "Excel".
You'll see 3 programs that demonstrate on handling data to an Excel sheet (also with multiple worksheets).
The programs are using dummy data and via SE38 you can view the source code better.
Programs: XXLFTEST, XXLSTEST and XXLTTEST.
Regards,
Rob.
Hello,
I'm trying to follow the code for creating multiple worksheet in an excel file via OLE. Can anyone here help me? I'm really having a hard time on this one.
So far I have 1 internal table which contains the data needed for excel download in multiple worksheets, I created an internal table for the 10 worksheet names.
Can somebody start the code for me? I just need 3 columns. My problem here is how to put the values from my internal table (select from TCURR) to the excel spreadsheet.
So far here's what I have coded: (referenced from sapfans.com)
--
data: w_book type ole2_object,
w_sheet type ole2_object,
excel type ole2_object.
create object excel 'EXCEL.APPLICATION'.
call method of excel 'WORKBOOKS' = w_book.
call method of w_book 'OPEN' exporting #1 = p_file.
if sy-subrc eq 0.
loop at i_worksheet. "contains the 10 worksheets that
"needs to be created
call method of excel 'Worksheets' = w_sheet
exporting #1 = i_worksheet-sheetname.
call method of w_sheet 'Activate'.
if sy-subrc eq 0.
*****Here's where I'm lost********
endif.
endloop.
endif.
--
Thanks in advance.
Regards,
Kristine
*Function Module to downlaod the dat into excel file
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = V_FNAME
TABLES
DATA_TAB = I_ALV
FIELDNAMES = I_FIELDNAME
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
ENDCASE.
Good old SAP Help
http://help.sap.com/saphelp_47x200/helpdata/en/21/b53138e1ba11d2bdbe080009b4534c/frameset.htm
Above,there is the link for spreadsheet interface. You can find all the help you need.
-
Please, give points if it helps.
Try DOI(Desktop Office Integration) EXCEL Inegration & pivot Interface.
SAP has many DEMO Programs under the Package SOFFICEINTEGRATION, you can have a look to these for better understanding with the SAP Office Integration.
See DOI(Desktop Office Integration) examples in DWDM & SE83.
I have done some work
URL http://www.geocities.com/ojnc/freestuff.html
Download http://www.geocities.com/ojnc/DOI_Excel_Pivot.zip
This makes DOI very easy to use.
The pivot interface object should be created soon after creating the document and spreadsheet interfaces object. Otherwise often it is not successful and returns a null pivot handle.
The Internal table for Pivot should have a header line otherwise DYN_ANALYSE_SINGLE will fail.
Add a comment