Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Excel generated based on layout and send into mail

0 Likes
1,467

I need to send excel in mail based on selected layout.

Any function module to convert spool in excel and send into mail.

I need to send excel in mail based on selected layout.

Any function module to convert spool in excel and send into mail.

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,078

From a spool (abap list or even OTF) I don't think you will be successful, but from an ALV you may be luckier:

Using

  • cl_salv_bs_runtime_info=>set " prevent ALV display and store data/metadata
  • submit report " execute ALV
  • cl_salv_bs_runtime_info=>get_data_ref " get data
  • cl_salv_bs_runtime_info=>get_metadata " get metadata
  • cl_salv_ex_util=>factory_result_data_table " prepare data
  • cl_salv_bs_tt_util=>if_salv_bs_tt_util~transform " generate xml
  • cl_salv_bs_runtime_info=>clear_all " cleanup

you should get a xml similar to the result of menu List, Export, Spreadsheet.

Regards,
Raymond

Read only

matt
Active Contributor
0 Likes
1,078

I wrote a program to do this. There are function module to read the spool. You can then, after writing code (similar to a screen scraper) to get the information in some kind of order, using some standard code (search for it - it's not hard to find) or abap2xlsx to output an Excel spreadsheet.

Sending it by mail is very simple and well documented - you should search to see how it is done. There are some useful blogs.

There is no single function module that does what you want. You have to write ABAP code yourself.