on 01-13-2015 12:02 PM
Hello,
I've developed wd to display table then I placed a 'getpdf' button on the view to download the contents of that table, In that action button I wrote the following code.
But it doesn't seem to be working.
DATA lo_nd_emp_det TYPE REF TO if_wd_context_node.
DATA:
lt_emp_det TYPE wd_this->elements_emp_det,
ls_emp_det TYPE wd_this->element_emp_det.
DATA:
str TYPE string,
xstr TYPE xstring.
* navigate from <CONTEXT> to <EMP_DET> via lead selection
lo_nd_emp_det = wd_context->get_child_node( name = wd_this->wdctx_emp_det ).
lo_nd_emp_det->get_static_attributes_table( IMPORTING table = lt_emp_det ).
"Prepare download file.
LOOP AT lt_emp_det INTO ls_emp_det.
CONCATENATE str
ls_emp_det-pernr
ls_emp_det-nachn
ls_emp_det-vorna
ls_emp_det-gbdat
cl_abap_char_utilities=>newline
INTO str
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
IMPORTING
buffer = xstr
EXCEPTIONS
failed = 1.
"Attach file
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'Download.xls'
i_content = xstr
i_mime_type = 'EXCEL'
i_in_new_window = abap_false
i_inplace = abap_false.
The sy-subrc retruning zero, But I couldn't see file downloaded.
Please help me.
regards,
Nagendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you checked whether value for XSTR is getting filled before using it in attach_file_to_response( ) . Refer this thread which might help you.
FPM / Method cl_wd_runtime_services=>attach_file_to_response is not working
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.