05-31-2007 9:36 PM
Hi,
I got this piece of code from forum.this works fine in frontend but I need this functionality in background.Any ideas?
REPORT C.
TABLES: BKPF.
*
DATA: BEGIN OF ITAB OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
END OF ITAB.
*
DATA: BEGIN OF ITAB_FIELD OCCURS 0,
TXT(10),
TXT1(10),
END OF ITAB_FIELD.
PARAMETERS:
P_FILE TYPE RLGRAP-FILENAME DEFAULT '
xyz\xyxxx\test'.
START-OF-SELECTION.
*
SELECT BUKRS GJAHR FROM BKPF INTO TABLE ITAB UP TO 100 ROWS.
*
ITAB_FIELD-TXT = 'Bukrs'. APPEND ITAB_FIELD.
ITAB_FIELD-TXT = 'Gjahr'. APPEND ITAB_FIELD.
*
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = P_FILE
TABLES
DATA_TAB = ITAB
FIELDNAMES = ITAB_FIELD
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_PIVOT_FIELDS = 6
DOWNLOAD_PROBLEM = 7
OTHERS = 8.
*
IF SY-SUBRC <> 0.
WRITE: / SY-SUBRC.
ENDIF.
*
regards
Praveen
05-31-2007 9:52 PM
Hi,
You cannot download it in background. During background execution, the processing is done in the server side, not on your client side. So anything on your desktop including Excel programs, local desktop directories are not available to the program during background execution.
You will have to download it as a tab delimited file to the application server, ftp it to your desktop and open it with excel.
aRs
05-31-2007 9:52 PM
Hi,
You cannot download it in background. During background execution, the processing is done in the server side, not on your client side. So anything on your desktop including Excel programs, local desktop directories are not available to the program during background execution.
You will have to download it as a tab delimited file to the application server, ftp it to your desktop and open it with excel.
aRs
05-31-2007 9:54 PM
'EXCEL_OLE_STANDARD_DAT',
GUI_DOWNLOAD
WS_DOWNLOAD These function module will not work in background.
if you want to work in background then use open dataset command.
05-31-2007 10:01 PM