Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FILE DOWNLOAD ISSUE IN WEB DYNPRO

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

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question