2010 Oct 27 1:14 PM
Dear All,
This may be a basic question, however, I just need a tip to conclude my issue.
I have a Report that displays Financial Budget data (AFE). I am able to download to the Excel sheet. However, I need to conclude it with the column formatted at code itself and not given to the user.
That is I want to set couple of column to Numeric, and Set Colum width defined at Code level itself.
I am already using the Function module : MS_EXCEL_OLE_STANDARD_DAT
Regards,
Venkat
Dear All,
This may be a basic question, however, I just need a tip to conclude my issue.
I have a Report that displays Financial Budget data (AFE). I am able to download to the Excel sheet. However, I need to conclude it with the column formatted at code itself and not given to the user.
That is I want to set couple of column to Numeric, and Set Colum width defined at Code level itself.
I am already using the Function module : MS_EXCEL_OLE_STANDARD_DAT
Regards,
Venkat
2010 Oct 28 6:40 AM
data: go_excel type ole2_object,
Go_CELL TYPE OLE2_OBJECT,
go_workbooks TYPE OLE2_OBJECT,
go_workbook TYPE OLE2_OBJECT,
go_sheet type OLE2_OBJECT,
go_application type OLE2_OBJECT,
go_activesheet type OLE2_OBJECT,
go_text type OLE2_OBJECT.
gv_EXTRD = sy-datum.
gv_EXTRT = sy-uzeit.
concatenate pfile gv_EXTRD gv_EXTRT 'check.xls' into gv_file.
clear: gt_export, gs_export.
****INITIATE EXCEL
Create object Excel
create object go_excel 'EXCEL.APPLICATION'.
set property of go_excel 'Visible' = 0.
Create workbook object
call method of go_excel 'WORKBOOKS' = go_workbook .
Add workbook
call method of go_workbook 'Add' = go_workbook.
lv_line = 0.
loop at gt_collect ASSIGNING <collect>.
lv_line = lv_line + 1.
move-corresponding <collect> to gs_export.
clear: gs_export-ZALDT.
concatenate <collect>-ZALDT4(2) '-' <collect>-ZALDT6(2) '-' <collect>-ZALDT+0(4)
into gs_export-ZALDT.
Populate cells
call method of go_excel 'Cells' = Go_CELL
EXPORTING
#1 = lv_line
#2 = 1.
**************SET UP PROPERTY WIDTH ****************************
SET PROPERTY OF GO_CELL 'ColumnWidth' = '11'.
SET PROPERTY OF GO_CELL 'Value' = gs_export-BANKL.
***********SET PROPERTY CELL NUMBER**************************************
call method of go_excel 'Cells' = Go_CELL
EXPORTING
#1 = lv_line
#2 = 4.
SET PROPERTY OF go_cell 'NumberFormat' = '@'. "PROPERTY NUMBER
SET PROPERTY OF GO_CELL 'ColumnWidth' = '10'.
SET PROPERTY OF GO_CELL 'Value' = gs_export-ZALDT.
endloop.
**CLOSE EXCEL**********
CALL METHOD OF go_workbook 'SaveAs'
EXPORTING #1 = gv_file
#2 = 1.
"file format
CALL METHOD OF go_workbook 'close'. "file format
call method of go_excel 'QUIT'.
****OPEN CREATED EXCEL FILE ****************************
call method of go_excel 'Workbooks' = go_workbooks.
call method of go_workbooks 'Open'
EXPORTING
#1 = gv_file.
set property of go_excel 'Visible' = 1.
2011 Aug 16 7:06 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |