2009 Nov 21 9:46 AM
Hi,
How to export the Report in Excel format directly from the SAP to my Desktop.
Plz. give me the process???
Thanks
Hi,
How to export the Report in Excel format directly from the SAP to my Desktop.
Plz. give me the process???
Thanks
2009 Nov 21 9:49 AM
Hi,
Follow below path.
Menu=>System=>List=>Save=>Local file.
Thanks,
Vinod/
2009 Nov 21 10:05 AM
Dear Vinod,
I want that when i execute the report, that output should save automatically in Excel on my desktop.
My requirement: - We want to schedule the report at night and when this report execute at given time, then this should save in Excel File on any location like desktop.
Plz help..
2009 Nov 21 10:21 AM
Hi,
I don't think its a feasible option. Because background processor can't communicate to local PC.
But i have seen one document in SDN which says by making your PC as an RFC connection with R/3 you can achieve this.
Didn't try this option. Just check below link.
Thanks,
Vinod.
2009 Nov 21 11:05 AM
What you say...it is possible or not to export directly in Excel file...
2009 Nov 21 11:12 AM
Hi,
Just try the process mentioned in the link i sent earlier. Even i also didn't try that. Just have read that doc.
But i can suggest 2 work arounds for your problem if you can compromise on requirement to some extent.
1. Download to unixfile
2. Send the output as excel attachment in E-mail.
Thanks,
Vinod.
2009 Nov 21 11:44 AM
Yes. I have done the job with the function module WS_EXCEL..
in it when i execute the report, it open the excel file with the output data.
I want to one thing here that how can it save directly to desktop. becuase now it open the files with data but i want it should be save and closed automatically.
thanks
2009 Nov 21 12:54 PM
Hi,
I hope you are running the report in fireground. WS_EXCEL won't work in background. For foreground you can use FM GUI_DOWNLOAD.
Thanks,
Vinod.
2009 Nov 23 7:54 AM
I want report ouptput in Excel, when i execute Report in Background.
Because when we schedule any report, it should be run in bachground, not foreground.
2009 Nov 23 8:26 AM
Hello,
You could have easily found out that it is not possible to download to presentation server while running a report as a background job had you searched before posting. You can only download to the application server. If you still want to take the pain of downloading in background, you could try downloading your required files in a shared network drive in background using DATASET statements
Vikranth
2009 Nov 21 10:35 AM
use this,
INCLUDE OLE2INCL.
INCLUDE EXCEL__C.
AND
H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT, " font
H TYPE I.
AND
PERFORM SUB_GET_DATA.
'get data here
PERFORM SUB_POP_DATA.
'populate data here
AND
PERFORM SUB_DISP_EXCEL.
&----
*& Form SUB_DISP_EXCEL
&----
*
----
FORM SUB_DISP_EXCEL.
START EXCEL
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
SET PROPERTY OF H_EXCEL 'Visible' = 1. " for printing o/p line by line in excel sheet
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 10 'Mat Doc Number'(001) 'R'.
PERFORM FILL_CELL USING 1 2 1 4 'Item'(002) 'R'.
PERFORM FILL_CELL USING 1 3 1 10 'Mat Doc Date'(003) 'R'.
PERFORM FILL_CELL USING 1 4 1 10 'Vendor'(004) 'R'.
PERFORM FILL_CELL USING 1 5 1 20 'Mat Doc Item amount'(005) 'R'.
PERFORM FILL_CELL USING 1 6 1 15 'Material price'(006) 'R'.
PERFORM FILL_CELL USING 1 7 1 4 'Currency'(007) 'R'.
PERFORM FILL_CELL USING 1 8 1 18 'Material'(008) 'R'.
PERFORM FILL_CELL USING 1 9 1 30 'Material Desc'(009) 'R'.
PERFORM FILL_CELL USING 1 10 1 19 'Qty in Unit of Entry'(010) 'R'.
PERFORM FILL_CELL USING 1 11 1 19 'Qty Received'(011) 'R'.
PERFORM FILL_CELL USING 1 12 1 4 'Unit of Entry'(012) 'R'.
PERFORM FILL_CELL USING 1 13 1 20 'Mat Group'(013) 'R'.
PERFORM FILL_CELL USING 1 14 1 16 'Vendor Invoice'(016) 'C'.
LOOP AT T_OUT INTO W_OUT.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 10 W_OUT-MBLNR 'R'.
PERFORM FILL_CELL USING H 2 0 4 W_OUT-ZEILE 'R'.
PERFORM FILL_CELL USING H 3 0 10 W_OUT-BLDAT 'R'.
PERFORM FILL_CELL USING H 4 0 10 W_OUT-LIFNR 'R'.
PERFORM FILL_CELL USING H 5 0 20 W_OUT-DMBTR 'R'.
PERFORM FILL_CELL USING H 6 0 15 W_OUT-NETPR 'R'.
PERFORM FILL_CELL USING H 7 0 4 W_OUT-WAERS1 'R'.
PERFORM FILL_CELL USING H 8 0 18 W_OUT-MATNR 'R'.
PERFORM FILL_CELL USING H 9 0 30 W_OUT-MAKTX 'R'.
PERFORM FILL_CELL USING H 10 0 19 W_OUT-ERFMG 'R'.
PERFORM FILL_CELL USING H 11 0 19 W_OUT-WEMNG 'R'.
PERFORM FILL_CELL USING H 12 0 4 W_OUT-ERFME 'R'.
PERFORM FILL_CELL USING H 13 0 20 W_OUT-WGBEZ 'R'.
PERFORM FILL_CELL USING H 14 0 16 W_OUT-XBLNR 'C'.
CLEAR W_OUT.
ENDLOOP.
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTIN G #1 = 2.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
PERFORM ERR_HDL USING 'Unable to create workbook'.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2. "----------can remove-------THIS IS FOR STAY AT LIST
PERFORM ERR_HDL USING 'Unable to create new workbook'..
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL USING 'Unable to free workbook'.
ENDFORM. " SUB_DISP_EXCEL
-
----
FORM FILL_CELL *
----
sets cell at coordinates i,j to value val boldtype bold *
----
FORM FILL_CELL USING I J BOLD COL VAL I_HORIZON_ALIGN.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL USING 'set cell object error'.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL USING 'set value object error'.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL USING 'set font object error'.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL USING 'set bold object error'..
SET PROPERTY OF H_ZL 'ColumnWidth' = COL.
PERFORM ERR_HDL USING 'set columnwidth object error'.
IF NOT I_HORIZON_ALIGN IS INITIAL.
IF I_HORIZON_ALIGN = 'L'.
SET PROPERTY OF H_ZL 'HorizontalAlignment' = XLLEFT.
ELSEIF I_HORIZON_ALIGN = 'R'.
SET PROPERTY OF H_ZL 'HorizontalAlignment' = XLRIGHT.
ELSEIF I_HORIZON_ALIGN = 'C'.
SET PROPERTY OF H_ZL 'HorizontalAlignment' = XLCENTER.
ENDIF.
ENDIF.
PERFORM ERR_HDL USING 'set Alignment object error'.
ENDFORM. "FILL_CELL
&----
*& Form ERR_HDL
&----
outputs OLE error if any *
----
--> p1 text
<-- p2 text
----
FORM ERR_HDL USING VAL.
IF SY-SUBRC <> 0.
WRITE: / VAL.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |