Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Report output in background -download in Excel format to virtual dir

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

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

3 REPLIES 3

former_member194669
Active Contributor
0 Kudos

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

Former Member
0 Kudos

'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.

0 Kudos

Thank you all.