cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed: Download to excel without pop-up

Former Member
0 Kudos

Hi All,

In a particular scenario, I require to trigger an action once a file have been successfully downloaded to EXCEL from Webdynpro UI. But in case of download functionilty, once the MS window pop-up for download comes up, the control is lost from Webdynpro and its impossible to track whether user have saved, opened or canceled the file.

Is there any functionality to directly download internal table content to EXCEL, without facing the download popup. Please let me know any function module or functionality for this.

Thanks in advance to all.

Regards,

Mainak

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

If you want to save the excel , then you can even save it in MIME repository.

You have your content (type xstring) .

To put in mime use this code :

data : mime_repository type ref to if_mr_api,

content type xstring,

mime_type type string.

mime_repository = cl_mime_repository_api=>get_api( ).

call method mime_repository->put( exporting i_url = 'SAP/BC/BSP/SAP/WEB_UTILITY' i_content = content ).

And this file saved in Mime can also be retrieved using :

data: url type string value 'SAP/BC/BSP/SAP/myBSPapplication/yourfile.jpg'.

mime_repository = cl_mime_repository_api=>get_api( ).

call method mime_repository->get

exporting

i_url = url

importing

e_content = content.

e_mime_type = mime_type.

Give it a try if find useful.

Former Member
0 Kudos

yes there are many tutorials on SDN regarding this

u may procced like this :

get the contents in internal table and then use the FM 'SCMS_STRING_TO_XSTRING'


DATA text   TYPE string.
  DATA xtext  TYPE xstring.

*   get all declared attributes
  lo_nd_sbook->get_static_attributes_table(
    IMPORTING
     table = lt_sbook ).

  LOOP AT lt_sbook INTO ls_sbook.


CONCATENATE text ls_sbook-carrid
ls_sbook-connid
ls_sbook-fldate
ls_sbook-bookid
ls_sbook-order_date
ls_sbook-counter
ls_sbook-passname
cl_abap_char_utilities=>newline INTO text SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.

ENDLOOP.


    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text   = text
      IMPORTING
        buffer = xtext.
    wdr_task=>client_window->client->attach_file_to_response(
**path to the word file
i_filename = 'WDP.xls'
* String Variable
i_content =  xtext
* File Type
i_mime_type = 'EXCEL' ).


here it_sbook is the inernal table and ls_sbook is the structure type of the attributes declared in the context node sbook


  DATA ls_sbook TYPE wd_this->element_sbook.
*  data LT_SFLIGHT type WD_THIS->ELEMENTS_SFLIGHT.

  DATA lt_sbook TYPE wd_this->elements_sbook.

Edited by: amit saini on Oct 14, 2009 1:30 PM