on 05-08-2008 7:17 PM
hi, experts
I want to download pdf to local path directly, but when i
use the class method "cl_wd_runtime_services=>attach_file_to_response", the file is opened by web page.
How can i download file to a specified path directly?
This is a very urgent issue.
Thanks a lot!
Hi Li Ken,
I am not sure what do you mean for "download pdf to local path directly ".
To my understanding, it might be impossible for the case below.
=> Click a button in webdynpro view, then nothing happens, but you can find the pdf file in desired local path.
However, it is possible to have a pop-up window for specifying local pah, then pdf file is downloaded. (like Internet downloading).
Implement it using UI control - FileDownload
=> Add a control "FileDownload" in the view, then bind with property data a context attribute, which is associated with pdf source (type xstring).
Implement it using the method cl_wd_runtime_services=>attach_file_to_response.
=> please have a look at the code below.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_pdf_file LIKE ls_context-pdf_file.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `PDF_FILE`
IMPORTING
value = lv_pdf_file ).
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'file.pdf'
i_content = lv_pdf_file
i_mime_type = 'application/pdf'
* i_in_new_window = ABAP_FALSE
* i_inplace = ABAP_FALSE
.
Please reward points if helpful!
Best regards!
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.