2006 Mar 29 4:09 PM
Hi Gurus,
Is it possible to write the data to Excel file when I run the report in background mode. Which function module should I use?
Sanju
2006 Mar 29 4:13 PM
2006 Mar 29 4:15 PM
Hi,
try to download it to application server and then download it later.
you need to use open dataset and transfer , close data set. since frontend download is not possible in background.
Regards
Vijay
2006 Mar 29 4:19 PM
2006 Mar 29 4:24 PM
I usually like to write as a comma delimited file, here is a sample program.
report zrich_0001.
parameters:
d2 type localfile default '/usr/sap/TST/SYS/Data2.csv'.
data: it001 type table of t001 with header line.
data: iflat type table of string with header line.
field-symbols: <fs>.
start-of-selection.
* Get data
select * into table it001 from t001.
* Put data into flat structure with comma delimit
loop at it001.
clear iflat.
do.
assign component sy-index of structure it001 to <fs>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
iflat = <fs>.
else.
concatenate iflat <fs> into iflat separated by ','.
endif.
enddo.
append iflat.
endloop.
* Download to app server
open dataset d2 for output in text mode.
loop at iflat.
transfer iflat to d2.
endloop.
close dataset d2.
Regards,
Rich Heilman
2006 Mar 29 4:32 PM
Thanks guys,
I know I can write it to the server as a csv/flat file. Its an ALV report and if user runs it in foreground, it times out.
Was wondering if it can be written to Excel file. Sounds like it cannot be!
Thanks
Sanju
2006 Mar 29 4:35 PM
2006 Mar 29 4:51 PM
Yes it is. But you know how these user are, they do not want to take the pain to even format it while opening the file in Excel.
I awarded points for all your inputs.
Sanju
2006 Mar 29 4:53 PM