cancel
Showing results for 
Search instead for 
Did you mean: 

Download data to different worksheets in same MS Excel document

former_member206441
Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (2)

Answers (2)

rub_alfonso
Explorer
0 Kudos

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 !!

former_member206441
Contributor
0 Kudos

Hi Rub,

The solution given by you is to download an excel sheet with only tab of data. My requirement is to download data into different tabs in same excel sheet.

Dear Guru's

Any guidance for me??

Thanks & Regards

Arun.K.P

rub_alfonso
Explorer
0 Kudos

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 !!

RicardoRomero_1
Active Contributor
0 Kudos

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.