2011 Feb 01 12:06 PM
I transfer SAP ITAB to .txt file with --> SAP_CONVERT_TO_TEX_FORMAT
Now I want this .txt file to store at user defined Path (Location).
I used GUI_DOWNLOAD - And it's saved at Desktop. Which is as Required.
But For User Defined Path - when I try CALL METHOD lo_gui->directory_browse - It's not working.
2011 Feb 01 12:45 PM
Try this
parameters: p_path type localfile.
data: path_str type string.
at selection-screen on value-request for p_path.
call method cl_gui_frontend_services=>directory_browse
exporting
window_title = 'Select Directory'
changing
selected_folder = path_str
exceptions
cntl_error = 1.
call method cl_gui_cfw=>flush
exceptions
cntl_system_error = 1
cntl_error = 2.
p_path = path_str.
2011 Feb 01 12:46 PM
Hi priya,
To downlad the data which is in the internal table to the user defined location.
First use the method
CALL METHOD cl_gui_frontend_services=>directory_browse
then ..
for saving the file in the location call the method
CALL METHOD cl_gui_frontend_services=>file_save_dialog
For example
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
default_extension = 'txt'
file_filter = 'Text Files(*.TXT)' "for text files
initial_directory = 'C:\'
* prompt_on_overwrite = 'X'
CHANGING
filename = l_filename "File Names
path = l_path " Path of the file
fullpath = l_fullpath. " Full path including the file name
then use the GUI_DOWNLOAD FM to transfer the data in the itab to the file which you are saving in the presentation server.
Hope it helps.
Regards,
Phani
2011 Feb 01 12:53 PM
Hi,
For better solution why cant you give a parameter in the selection screen asking for the file path.
Please use CL_GUI_FRONTED_SERVICES=>FILE_SAVE_DIALOG for getting the file path at the selection on value request for that parameter.
If you do like this, in the GUI_DOWNLOAD you need to pass this filepath only.
With Regards,
Sumodh.P