2007 Oct 05 4:44 AM
Hi all,
I have a requirement that I have to download the ALV list into a Local file (Presentation Server) . For that we have an option in the ALV Tool bar. In that we have a lot of option Unconverted,Spreadsheet,Word.....etc.. <b>But, I want only the UNCONVERTED</b> . Once we give Unconverted it asks for file name in that <b>i want a default file name corresponding to my selection screen parameter..</b>
Can any body help me??
Hi all,
I have a requirement that I have to download the ALV list into a Local file (Presentation Server) . For that we have an option in the ALV Tool bar. In that we have a lot of option Unconverted,Spreadsheet,Word.....etc.. <b>But, I want only the UNCONVERTED</b> . Once we give Unconverted it asks for file name in that <b>i want a default file name corresponding to my selection screen parameter..</b>
Can any body help me??
2007 Oct 05 4:49 AM
Hi Gopi,
That is not possible.
Instead you can create your own button on ALV toolbar say 'DOWNLOAD" button.
When user clicks on it, use FM "GUI_DOWNLOAD" & pass the internal table & file name which user has entered.
* This method of file download with check uses the latest techniques
* and achieves a very neat solution
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:temp'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
* Check user did not cancel request
CHECK ld_result EQ '0'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
* APPEND = 'X'
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.Best regards,
Prashant
2007 Oct 05 4:53 AM
Thanks for ur reply,
I think that in this way, we can download only the contents of a particular Internal Table. am i right?? if yes, i have some other values in that list apart from the alv internal table. i.e. i used at end of list.
2007 Oct 05 4:57 AM
Hi Gopi,
You can APPEND the same file with different data.
* HEADER DATA
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
* APPEND = 'X' "Commented for 1st time
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_header[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
* ITEM DATA
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
APPEND = 'X' " Uncommented
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_item[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
* FOOTER DATA
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
APPEND = 'X' "Uncommented
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_footer[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
2007 Oct 05 5:00 AM
2007 Oct 05 5:17 AM
Hi Gopi,
You can move all the variables to an internal table & download the same.
Best regards,
Prashant