cancel
Showing results for 
Search instead for 
Did you mean: 

create and download Excel file with multiple worksheet in sap webdynpro abap

Ajay_Kumar
Discoverer
0 Kudos

Hello All, I have a requirement, in which i need to create create and download XLSX file from Webdynpro ABAP.

I am able to create simple XLSX file and download it, but i am not able to create XLSX file with multiple worksheet.

I have data in xstring format and using cl_wd_runtime_services=>attach_file_to_response  to download excel file.

Kindly guide me , how can i create multiple worksheet in same excel file in webdynpro abap.

I am following below process:

I am creating and xlsx file from webdynpro abap. I am able to create a xlsx file with one worksheet using the standard functionality of sap.
1. getting reference of internal table.

2. using cl_salv_table=>factory to create the reference of output data.

3. Using cl_salv_controller_metadata=>get_lvc_fieldcatalog  to create the field catalogue.

4. Using cl_salv_ex_util=>factory_result_data_table, input is the field catalogue and the refernce internal table.

5. cl_salv_bs_tt_util=>if_salv_bs_tt_util~transform  is used to transform this data in xtsring .

6. this way the xlsx created is perfect, there is no need to formatting and other issue, Xlsx cerated will be same as we get using the standard EXPORT button.

7. use cl_wd_runtime_services=>attach_file_to_response  to download the xlsx file.

8. I want to add new worksheet in this excel, is there is any way, pls guide.

Sandra_Rossi
Active Contributor
If you can download a file from Web Dynpro, then it's not a Web Dynpro question, it's only a question about generating Excel content with ABAP code, whatever the context is. Hopefully, it has been answered tens of times in the forum already.
ChrisSolomon
Active Contributor

"I am searching from many days, but not able to get answer." Really? REALLY????

It literally took me 2 seconds to Google "ABAP create worksheet in excel" and find several posts.

This one from SCN.... https://community.sap.com/t5/application-development-discussions/how-can-i-add-new-worksheet-tab-to-...

This one from a blog... https://sapabapcentral.blogspot.com/2019/01/create-excel-worksheet-xls-file-using.html

Sandra_Rossi
Active Contributor
Let me reshape my answer. Hopefully, it has been answered tens of times in the forum already.

Accepted Solutions (0)

Answers (2)

Answers (2)

Ajay_Kumar
Discoverer
0 Kudos

Thanks for your comments, let me reshape my question.
I am creating and xlsx file from webdynpro abap. I am able to create a xlsx file with one worksheet using the standard functionality of sap.
1. getting reference of internal table.

2. using cl_salv_table=>factory to create the reference of output data.

3. Using cl_salv_controller_metadata=>get_lvc_fieldcatalog  to create the field catalogue.

4. Using cl_salv_ex_util=>factory_result_data_table, input is the field catalogue and the refernce internal table.

5. cl_salv_bs_tt_util=>if_salv_bs_tt_util~transform  is used to transform this data in xtsring .

6. this way the xlsx created is perfect, there is no need to formatting and other issue, Xlsx cerated will be same as we get using the standard EXPORT button.

7. use cl_wd_runtime_services=>attach_file_to_response  to download the xlsx file.

8. I want to add new worksheet in this excel, is there is any way, pls guide.

 

Sandra_Rossi
Active Contributor
0 Kudos
Please do not post a solution for commenting the question. Use the "Show replies" of the question > Comment. Or better edit your question.
Ajay_Kumar
Discoverer
0 Kudos

Hello,

Thanks for your response.

I am searching from many days, but not able to get answer.

I can create Excel file, but the challenge is to create multiple worksheet in the Excel file.

If you know any answer, kindly guide me to the post.

Thanks.

Sandra_Rossi
Active Contributor
0 Kudos
Please do not post a solution for commenting the question. Use the "Show replies" of the question > Comment.