Skip to Content
avatar image
Former Member

Read ALV Spool List more than 255 Chars and send it in Excel

Hi Guys,

My requirement is to read SAP Query generated ALV Spool list (Each row contains Information more than 255 Char length) and send mail only in an Excel.

Currently I am using FM 'RSPO_RETURN_ABAP_SPOOLJOB’, but it truncates the data exceeds more than 255 char. I even tried FM CONVERT_ABAPSPOOLJOB_2_PDF, although it works fine to solve length issue, I couldn't able send it in Excel format through email.

Please help me to solve this puzzle.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 01, 2017 at 12:27 PM

    Don't generate a spool, use cl_salv_bs_runtime_info instead.

    NB: You can even generate a mtml file with this class, cl_salv_ex_util and cl_salv_bs_tt_util.

    * Set Handler
          call method cl_salv_bs_runtime_info=>set
              display  = abap_false
              metadata = abap_true
              data     = abap_true.
    * Call report
          submit (i_report)
           using selection-set (i_variant)
           and return.
    * get data back
          call method cl_salv_bs_runtime_info=>get_data_ref
              r_data = gr_data.
    * get medtadata back
          ls_metadata = cl_salv_bs_runtime_info=>get_metadata( ).
    * simulate the ALV
          lr_result_data = cl_salv_ex_util=>factory_result_data_table(
            r_data                 = gr_data
            s_layout               = ls_metadata-s_layout
            t_fieldcatalog         = ls_metadata-t_fcat
            t_sort                 = ls_metadata-t_sort
            t_filter               = ls_metadata-t_filter ).
    * convert to mhtml
              xml_version   = if_salv_bs_xml=>version
              r_result_data = lr_result_data
              xml_type      = if_salv_bs_xml=>c_type_mhtml
              xml_flavour   = if_salv_bs_c_tt=>c_tt_xml_flavour_export
              gui_type      = if_salv_bs_xml=>c_gui_type_gui
              xml           = e_xml ).
    * be clean
          cl_salv_bs_runtime_info=>clear_all( )
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 01, 2017 at 02:37 PM

    Just my opinion, but I think it would be easier to just rewrite the query into a report. The time saved by generating an excel directly from data should easily make up for the time to write the report. A SAP query report isn’t usually that complex.

    Add comment
    10|10000 characters needed characters exceeded