Download into different sheets of excel

Question:
Hi,
Can anybody tell how to download the data into different sheets of a single excel file...
ABAPer
Answer:
C'mon, why would SAP want to write that functionality ? You'll need to do some work in Excel itself me thinks !
Answer:
Despite what Guest says, have a look here:
/forums/viewtopic.php

_________________
Regards
R
Abap KC

SFMDR

Answer:
4/10 Must try harder !
Answer:
I tried a sample coding because of having a spare time today.
This works. Sheet 1 and 2 will be like below.
1x 1 1x 2 1x 3
2x 1 2x 2 2x 3
3x 1 3x 2 3x 3
4x 1 4x 2 4x 3
5x 1 5x 2 5x 3
T.Yamagiwa
**********************
REPORT zyamagi_excel .
**********************
INCLUDE ole2incl.
INCLUDE docsincl.
* OLE object handlers
DATA: h_excel TYPE ole2_object,
h_workbooks TYPE ole2_object,
h_workbook TYPE ole2_object,
h_sheets TYPE ole2_object,
h_sheet TYPE ole2_object,
h_cells TYPE ole2_object.
* working area
DATA: row(2) TYPE p,
column(2) TYPE p.
DATA: char_row(4), char_column(4), tmpvalue(10).
DATA: filename(100) VALUE 'c:\temp\a.xls'.
*******************
START-OF-SELECTION.
*******************
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
SET PROPERTY OF h_excel 'VISIBLE' = 1.
CALL METHOD OF h_excel 'WORKBOOKS' = h_workbooks.
* You might want to OPEN existing file instead of ADDing new one.
* CALL METHOD OF h_workbooks 'OPEN' EXPORTING #1 = filename.
CALL METHOD OF h_workbooks 'ADD' = h_workbook.
CALL METHOD OF h_workbook 'Sheets' = h_sheets .
DO 2 TIMES.
CALL METHOD OF h_sheets 'Item' = h_sheet
EXPORTING #1 = sy-index .
row = 1.
WHILE row =< 5.
column = 1.
WHILE column =< 3.
char_row = row.
char_column = column.
CONCATENATE char_row 'x' char_column INTO tmpvalue.
CALL METHOD OF h_sheet 'Cells' = h_cells
EXPORTING #1 = row
#2 = column.
SET PROPERTY OF h_cells 'Value' = tmpvalue.
column = column + 1.
ENDWHILE.
row = row + 1.
ENDWHILE.
ENDDO.
CALL METHOD OF h_workbook 'SAVEAS'
EXPORTING #1 = filename.
FREE OBJECT: h_cells, h_sheet, h_sheets,
h_workbook, h_workbooks, h_excel.
Answer:
Guest humbly apologises
Answer:
Hi Yamagiwa,
Excelllent.....Great answer
Thanks for that
ABAPer
Answer:
I was reading this question and thought...."I'm sure R has covered this before".
Sure enough, I was right.
Perhaps the moral of this story is.... Use the SEARCH facility!!!!
Dr Sidewalk :]
p.s. Yet another question which has already been answered in the past. These types of questions do tend to be made by GUEST accounts. Perhaps this site should ban them, thus forcing them to create a log-in account and therefore log-in properly. After all, if they are going to ask such questions they're certainly coming back to ask more so having a proper log-in will benefit all. :]
_________________
"In the middle of difficulty lies opportunity" - Albert Einstein
"Money isn't everything in life, unless you don't have it". David King
"Fail to plan, plan to fail"
"Success is a journey, not a destination."
Answer:
I was reading this question and thought...."I'm sure R has covered this before".
Sure enough, I was right.
Perhaps the moral of this story is.... Use the SEARCH facility!!!!
Dr Sidewalk :]
p.s. Yet another question which has already been answered in the past. These types of questions do tend to be made by GUEST accounts. Perhaps this site should ban them, thus forcing them to create a log-in account and therefore log-in properly. After all, if they are going to ask such questions they're certainly coming back to ask more so having a proper log-in will benefit all. :]
Yep, but unfortunately I mis-cut the hyperlink.....
_________________
Regards
R
Abap KC

SFMDR

Answer:
how I can sheet1, sheetx rename to my own name ?
thanks
Answer:
You'll need to select the sheet and then find the OLE command to name the sheet.
R has posted a lot of information on OLE in the past - and the best suggestion to find new commands, is record what you want to do as a macro and then look at the VB generated - this will allow you to call these commands from your ABAP.
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru
Answer:
ooops.... Try here
. This shows you how to do what you ask. Got it right this time. I hope!
_________________
Regards
R
Abap KC

SFMDR

More Articles:

Classification for a user defined object?
Excluding in menu .?
Submit transporting a internal table (ABAP)?
Dynamic selection-screen.?
multithreading in abap objects?
Attaching doc to Service request in CIC0: (CRM)?