04-05-2006 3:21 PM
Hi all,
I need to download the output which is present in alv into a file.How can i do that?.
Regards,
Lisa.
04-05-2006 3:23 PM
Hi Lisa,
There should be standard buttons in the ALV to download the ALV to Excel, local file, and so on.
Regards,
John.
04-05-2006 3:26 PM
04-05-2006 3:28 PM
Hi
u can use
gui_download
v_file id nothing but the local file name
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'v_file'
FILETYPE = 'ASC'
tables
data_tab = internal table
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
or
after the output u do this
system->list->save->localfile.
here u can download it in the local file.
thanks
Vikrant
04-05-2006 4:16 PM
Hi Rich,
I need to download a file which iam getting randomly and the user will give me the file format also. so i need show the the output in file name which the user has mentioned and the output file must be in the format which the user is mentioned. like xml ,csv. etc
for example the file name is
temp and the format is xml the i need to show the out put in temp.xml
i hope u understood my requirement.
Regards,
Lisa.
Message was edited by: Lisa Roy
04-05-2006 4:19 PM
Take the filename and format as parameters on the selection screen and use the parameters as the file name and format when passing to the FM.
Parameters: PFile like rlgrap-filename..
p_format like rlgrap-filetype..
Regards,
Ravi
04-05-2006 4:20 PM
I see, so you don't want to use the built in standard functionality provided by the grid, right?
If not, you will need to set a new button on your application toolbar using SET PF-STATUS, when the user clicks on this button you can throw a dialog where they can enter the path/file, then you can format your internal table and pass it to the GUI_DOWNLOAD(fm or method).
Regards,
RIch Heilman
04-05-2006 4:26 PM
Hi Rich,
Yes, I dont want to use the standard functionality.
Regards,
Lisa.
04-05-2006 4:38 PM
04-05-2006 3:31 PM
u can download to excel file
click on the export button in application toolbar
spreadsheet-->press enter-->pivot-->microsoft excel
u willl get the data in sheet1 of that excel generated
04-05-2006 3:38 PM
Hi,
Press CTRLSHIFTF9 for downloading the ALV output to your system. Its ask your to select the required format Eg HTML file, PLain Text etc and also the location where it must be saved.
Thanks,
Ramu N
04-05-2006 4:42 PM
hello Lisa,
I used once the mentioned method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD (which I think calls intern the FM 'GUI_DOWNLOAD', isn't that funny, a method calls a FM...):
Concatenate the drive, the filename and the type of file into the filename like:
CONCATENATE 'D:\' 'temp' '.XLS' INTO l_filename.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
BIN_FILESIZE =
filename = l_filename
filetype = 'ASC'
APPEND = SPACE
write_field_separator = 'X'
HEADER = '00'
trunc_trailing_blanks = 'X'
WRITE_LF = 'X'
COL_SELECT = SPACE
COL_SELECT_MASK = SPACE
dat_mode = 'X'
confirm_overwrite = 'X'
IMPORTING
FILELENGTH =
CHANGING
data_tab = itab.
that worked at least with Excel. User could open the file on 'D:temp.xls' and it opened as an excel-file.
Regards,
Samir
04-05-2006 4:54 PM
Please look into my requirement. which i have replied to Rich Heilman.
Regards,
Lisa.