Sending the Multiple ALVs as PDF Attachment through Email

...Previous

Step 7: Displaying the three ALVs in background

lv_repid  = sy-repid.


  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      i_callback_program = lv_repid.

*call first ALV append list
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout                  = lv_layout
      it_fieldcat                = li_fieldcat1
      i_tabname                  = 'I_ORDERS1'
      it_events                  = li_events_1[]
    TABLES
      t_outtab                   = i_orders1
    EXCEPTIONS
      program_error              = 1
      maximum_of_appends_reached = 2
      OTHERS                     = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout                  = lv_layout
      it_fieldcat                = li_fieldcat2
      i_tabname                  = 'I_ORDERS2'
      it_events                  = li_events_2
    TABLES
      t_outtab                   = i_orders2
    EXCEPTIONS
      program_error              = 1
      maximum_of_appends_reached = 2
      OTHERS                     = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout                  = lv_layout
      it_fieldcat                = li_fieldcat3
      i_tabname                  = 'I_INVSTATUS'
      it_events                  = li_events_3
    TABLES
      t_outtab                   = i_invstatus
    EXCEPTIONS
      program_error              = 1
      maximum_of_appends_reached = 2
      OTHERS                     = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

* Get the print parameters
  PERFORM sub_get_print_parameters.


  NEW-PAGE PRINT ON PARAMETERS x_params
          NO DIALOG.

  lx_print-print = ' '.
  lx_print-prnt_title = ' '.
  lx_print-prnt_info = ' '.
  lx_print-no_print_selinfos = 'X'. " Display no selection infos
  lx_print-no_print_listinfos = 'X'. " Display no listinfos
  lx_print-no_new_page = 'X'.

*display the data
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
      i_interface_check = ' '
      is_print          = lx_print
    EXCEPTIONS
      program_error     = 1
      OTHERS            = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  COMMIT WORK.
  NEW-PAGE PRINT OFF.

Subroutine to get print parameters

*&---------------------------------------------------------------------*
*&      Form SUB_GET_PRINT_PARAMETERS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM sub_get_print_parameters.

  DATA: lv_valid.                                          

  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      immediately    = 'X'
      no_dialog      = 'X'
      line_size      = '255'
      line_count     = '65'
      layout         = 'X_65_255'
      destination    = 'LP01'
    IMPORTING
      out_parameters = x_params
      valid          = lv_valid
    EXCEPTIONS
      OTHERS         = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    “SUB_GET_PRINT_PARAMETERS

Step 8: Report output in background.

The above spool output is finally sent as a PDF attachment to email addresses of multiple persons.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image