2006 Feb 01 2:08 PM
Hi.
The Excel file which gets dowloaded should be of the form.
Main Heading 1
SUB HEADING ( in the form of an INTERNAL TABLE )
Contents
Main Heading 2
SUB HEADING ( in the form of an INTERNAL TABLE )
Contents.
Let me know how effectively this can be done.
I have used the FM MS_EXCEL_OLE_STANDARD_DAT . But my exact requirement isn't served.
Thanks in advance.
Maheshwari.V
Hi.
The Excel file which gets dowloaded should be of the form.
Main Heading 1
SUB HEADING ( in the form of an INTERNAL TABLE )
Contents
Main Heading 2
SUB HEADING ( in the form of an INTERNAL TABLE )
Contents.
Let me know how effectively this can be done.
I have used the FM MS_EXCEL_OLE_STANDARD_DAT . But my exact requirement isn't served.
Thanks in advance.
Maheshwari.V
2006 Feb 01 2:12 PM
2006 Feb 01 2:14 PM
Hi,
Check this link and kindly reward points by clicking the star on the left of reply,if it helps.
2006 Feb 01 2:14 PM
have six itabs
itab1 for main heading,
itab2 for subheading
itab3 data
itab4 main heading2
itab5 subheading2
itab6 contents 2
download one by one to the same file name.
using GUI_DOWNLOAD
first call with append = ' ' .
and next 5 calls with append = 'X'
this is a crude way, but if you want more fancier handling, you can go for OLE programming.
Regards
Raja
2006 Feb 01 2:25 PM
Hi,
Hope finally u have entire data in one internal table.
Split the data into n tables according to criteria.
then Use GUI_DOWNLOAD
1) First time append = ' ' . "First heading
2) from the next time append = 'X'. "First internal table
again "Heading "Second ITAB
Thanks
Eswar
2006 Feb 01 2:39 PM
Here is an example of how you would create a new excel file and put data into.
report zrich_0002.
include ole2incl.
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.
data: field_value(30) type c.
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' .
* Write data to the excel file
* Here you are manipulating each cell one at a time.
* You can pretty much put the data anywhere you want.
* No restrictions.
do 20 times.
* Create the value
field_value = sy-index.
shift field_value left deleting leading space.
concatenate 'Cell' field_value into field_value separated by space.
* Position to specific cell in Column 1
call method of e_appl 'Cells' = e_cell
exporting
#1 = sy-index
#2 = 1.
* Set the value
set property of e_cell 'Value' = field_value .
* Position to specific cell in Column 2
call method of e_appl 'Cells' = e_cell
exporting
#1 = sy-index
#2 = 2.
* Set the value
set property of e_cell 'Value' = field_value .
* Position to specific cell in Column 3
call method of e_appl 'Cells' = e_cell
exporting
#1 = sy-index
#2 = 3.
* Set the value
set property of e_cell 'Value' = field_value .
enddo.
** Close the file
get property of e_appl 'ActiveWorkbook' = e_work.
call method of e_work 'SAVEAS'
exporting
#1 = p_file
#2 = 1. " Don't ask me when closing
call method of e_work 'close'.
* Quit the file
call method of e_appl 'QUIT'.
* Free them up
free object e_cell.
free object e_sheet.
free object e_work.
free object e_wbooklist.
free object e_appl.
Regards,
Rich Heilman
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |