05-16-2006 8:49 PM
Hi all,
We need to enable a report ouput to download into Excel.
Could you tell me is there any material/notes/sample documents available for this feature.
Any help is greatly appreciated.
Thnx very much.
05-16-2006 9:11 PM
Hello Deva,
You can do that in different ways.
1) By calling GUI_DOWNLOAD function module.
2) using ALV reports-user can download directly from the list if he wants to
3) You can display the list first and give one option for the user to download. In that write logic for downloding your file in XL format.
05-16-2006 8:52 PM
use GUI_DOWNLOAD function module & pass your final internal table to that & give file name & file type as DAT
give a parameter for filepath on the selection screen.
call the function module GUI_DOWNLOAD
& PASS, filename = your parameter name
filetype = 'ASC'
has_field_separator = 'X'
and tables
= your final internal table(which you are displaying on the output)
regards
Srikanth
Message was edited by: Srikanth Kidambi
05-16-2006 8:56 PM
Check out the sample, you can fire this function module automatically(as it is in this program) or fire it when the user clicks on a button from the application toolbar.
report zrich_0001.
data: imara type table of mara with header line.
start-of-selection.
select * into table imara up to 100 rows
from mara.
call function 'WS_EXCEL'
exporting
filename = 'TEST.XLS'
tables
data = imara.
Regards,
Rich Heilman
05-16-2006 9:00 PM
So that you are Unicode compliant, use the class object instead of the function module (GUI_DOWNLOAD).
DATA: BEGIN OF lt_data_tab OCCURS 0,
line(72),
END OF lt_data_tab,
l_filename TYPE string.
CONCATENATE path '\' i_name '.XLS' INTO l_filename.
READ REPORT i_name INTO lt_data_tab.
IF lines( lt_data_tab ) = 0.
MESSAGE e001(uc) WITH TEXT-TK0.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_filename
CHANGING
data_tab = lt_data_tab[]
EXCEPTIONS
OTHERS = 0.
IF sy-subrc <> 0.
MESSAGE e001(uc) WITH TEXT-K01.
ENDIF.
05-16-2006 8:58 PM
Is this an ALV report? Then that is a standard functionality. Otherwise, in case of a conventional report, you need to add a button using PF-status and do the coding for user-command.(also you can go by menu system-save-local file)
05-16-2006 9:00 PM
Hi
you can use the FM XXL_SIMPLE_API
se the sample program XXLSTEST
Regards,
Naveen
05-16-2006 9:01 PM
05-16-2006 9:11 PM
Hello Deva,
You can do that in different ways.
1) By calling GUI_DOWNLOAD function module.
2) using ALV reports-user can download directly from the list if he wants to
3) You can display the list first and give one option for the user to download. In that write logic for downloding your file in XL format.
05-16-2006 9:13 PM
thnx for the responses.
i'm using a conventional report not a alv report.
the user wants a button on the screen, and when it is clicked, the output should be downloaded into excel.
wt would be the better approach?
thnx a ton,
05-16-2006 9:17 PM
05-16-2006 9:24 PM
Here is a sample program, where the user hits a button on the application toolbar to fire the excel.
report zrich_0001.
data: imara type table of mara with header line.
start-of-selection.
set pf-status 'LIST'.
select * into table imara up to 100 rows
from mara.
loop at imara.
write:/ imara-matnr.
endloop.
at user-command.
case sy-ucomm.
when 'FIREEXCEL'.
call function 'WS_EXCEL'
exporting
filename = 'TEST.XLS'
tables
data = imara.
endcase.
Regards,
Rich Heilman
05-16-2006 9:26 PM
if you want to download it presentation server, use GUI_DOWNLOAD,as given by me in earlier post, if user clicks on that button "download".
use AT user command event, & if sy-ucomm = 'download" place the logic here.
regards
srikanth
05-17-2006 8:49 PM