Skip to Content
avatar image
Former Member

Excel generated based on layout 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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 14, 2017 at 06:32 AM

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


    • 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.


    Add comment
    10|10000 characters needed characters exceeded

  • Feb 14, 2017 at 06:57 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded