Skip to Content

Download data to different worksheets in same MS Excel document

Dear Experts,

Kindly guide me is there any possiblity in getting the data downloaded in same Excel sheet but into different worksheets??

Thanks & Regards

Arun.K.P

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 03, 2013 at 09:34 AM

    Hi Arun,

    Yes you can do this by using XML classes in SAP. I did this for color XSLT and you can add the code for making multiple sheets.

    You will need to create XML of the excel file.

    PFA the sample program (report program). You can create in WD with help of this.

    -Manish

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 03, 2013 at 08:43 AM

    Hi,

     

    I used to use ole2 Objects, but you can not use it from webdynpro applications, so I recommend you to use abap2xlsx, ckeck this blog by Ivan Femia where he explains how it works.

        

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 05, 2013 at 12:59 PM

    Hi Arun,

    You can do this using XML, transform XML as xstring and call this method.


    CALL METHOD cl_wd_runtime_services=>attach_file_to_response
    EXPORTING
    i_filename      = 'plantilla.XLS'
    i_content       = lv_content
    i_mime_type     = 'application/vnd.ms-excel'
    i_in_new_window = 'X'
    i_inplace       = 'X'.

    Regards !!

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Arun,

      I think you could do this:

      1) Upload an excel sheet (a kind of template) with different tabs on AL11 as XML. Take a look to that XML file, it will give you an idea of the pattern you have to follow to manage different TABS.

      2) Manage that XML data (from Web Dynpro) to insert data information on different tabs in the way you need. You can use "OPEN_DATASET" sentence from Web Dynpro.Firstly, get the information fas STRING and then convert to XSTRING.

      3) Once you have it as XSTRING, call

      CALL METHOD cl_wd_runtime_services=>attach_file_to_response
      EXPORTING
      i_filename      = 'plantilla.XLS'
      i_content       = lv_content
      i_mime_type     = 'application/vnd.ms-excel'
      i_in_new_window = 'X'
      i_inplace       = 'X'.

      Regards !!