07-23-2008 9:16 AM
Hi Guru,
I have 2 questions regarding this FM 'EXCEL_OLE_STANDARD_DAT'.
1. How do I change the file directory to sap directory. Instead of downloading to my own local pc directory, I wan it to download to AL11 (Sap directory).
2. How do I prevent the excel from showing in background? If I schedule it to batch job, will it cause problem?
Thanks.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:\USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Edited by: Hui Leng Yeoh on Jul 23, 2008 10:18 AM
07-23-2008 9:20 AM
Hi Hui
It is not possible to download excel file in background mode.
Regards
Anbu
07-23-2008 9:20 AM
Hi Hui
It is not possible to download excel file in background mode.
Regards
Anbu
07-23-2008 9:27 AM
Hi
That fm can works online only and it can download a file into presentation server only, so
1. How do I change the file directory to sap directory. Instead of downloading to my own local pc directory, I wan it to download to AL11 (Sap directory).
It means the SAP server can be available in your network, your network account (no SAP user) has to have the authorization to see the SAP server.
U can use the method FILE_OPEN_DIALOG of class CL_GUI_FRONTEND_SERVICES in order to show a popup to choose the path.
2. How do I prevent the excel from showing in background? If I schedule it to batch job, will it cause problem?
Just I've wrotten above, it can't works in background so u can test the system variable SY-BATCH in order to prevent it.
Max
07-24-2008 3:43 AM
Hi Max
Thanks for replying.
May I know is there a way that i can download table data into excel file?
Since I want to make it generic, meaning that for the same program, I want it to work for any table.
If merely for 1 table, i can use select the data from the table and then use dataset to transfer the file into SAP server. But in order for it to work in any table, do you think I can do it?
This will eventually have to be scheduled into batch job.
Thanks.
07-24-2008 10:54 AM