Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Create spool request and send to email from OO Alv

$
0
0

Hi Experts,

 

I have a requirement to email Alv report on button click.

The problem is it is OO ALV(cl_gui_alv_grid) and I want to have a spool request created after ALV is displayed from a custom button.

I tried generating the spool from set_table_for_first_display by setting is_print parameters but in this case also print dialogue box is not getting suppressed and directly spool is generated without displaying the output.

 

 

Below is my code implemented, where i am not able to suppress print dialogue box and not able to display output, only spool is generated.

Also I want to generate spool after ALV is displayed on custom button click

 

DATA: ls_print  TYPE lvc_s_prnt.

       DATA: lwa_params TYPE pri_params,

             lv_valid TYPE c.

       ls_print-print = 'X'.

       CALL FUNCTION 'GET_PRINT_PARAMETERS'

         EXPORTING

           in_parameters          = lwa_params

           layout                 = 'X_65_132'

           line_count             = 65

           line_size              = 132

           no_dialog              = 'X'

         IMPORTING

           out_parameters         = lwa_params

           valid                  = lv_valid

         EXCEPTIONS

           archive_info_not_found = 1

           invalid_print_params   = 2

           invalid_archive_params = 3

           OTHERS                 = 4.

       IF sy-subrc EQ 0.

         MOVE-CORRESPONDING lwa_params TO ls_print-print_ctrl-pri_params.

         ls_print-print_ctrl-pri_params-pdest = 'LP01'.

         NEW-PAGE PRINT ON PARAMETERS lwa_params NO DIALOG.


* Display the final table

         CALL METHOD gv_grid->set_table_for_first_display

           EXPORTING

*         it_toolbar_excluding          = gi_funct

             is_layout                     = ls_layout

             i_structure_name              = gv_stucname

*      it_alv_graphics  =

             i_save                        = gc_var_save

             is_variant                    = gs_variant

             is_print                      = ls_print

 

           CHANGING

             it_outtab                     = gt_final

             it_fieldcatalog               = gt_fieldcat

           EXCEPTIONS

             invalid_parameter_combination = 1

             program_error                 = 2

             too_many_lines                = 3

             OTHERS                        = 4.

 

 

         NEW-PAGE PRINT OFF.

       ENDIF.

 

     ENDIF.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>