Attachment User-Exit

The Attachment User-Exit can be used to add one or more attachments to the e-mail.

The parameters of the User-Exit are:

Parameter Type SAP Type Description
IM_ETYPE Importing /FLOE/ETYPE_CODE The e-mail type passed in to the API
IM_ELANG Importing /FLOE/ELANG The communication language for the e-mail
IM_DOCUMENT Importing /FLOE/DOC_REF The external document reference if passed into the API
IM_RECIPIENTS Importing /FLOE/REC_EMAIL_T Table of recipients for the e-mail
IM_VARIABLES Importing /FLOE/VARS_T Table of variables and their values
CH_ATTACHMENTS Changing /FLOE/ATT_T Table of attachments.  Table includes filename, description and attachment in XSTRING format

Sample code to add an attachment from the MIME repository:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
*---------------------------------------------------------------------------*
*                      <<< Start of Customer Code >>>                       *
*---------------------------------------------------------------------------*

  DATA: lv_content   TYPE xstring,
        lo_mime_rep  TYPE REF TO if_mr_api,
        ls_atts      TYPE /FLOE/ATT_S.
*
  lo_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).

  lo_mime_rep->get(
    EXPORTING
      i_url              = '/SAP/BC/BSP/FLM/PORTAL_MIMES/Images/Arch.jpg'
    IMPORTING
      e_content          = lv_content
    EXCEPTIONS
      parameter_missing  = 1
      error_occured      = 2
      not_found          = 3
      permission_failure = 4
      OTHERS             = 5 ).

  ls_atts-att_filename = 'Arch.jpg'.
  ls_atts-att_description = 'Arch logo'.
  ls_atts-att_data = lv_content.
  APPEND ls_atts TO ch_attachments.


*---------------------------------------------------------------------------*
*                      <<< End of Customer Code >>>                         *
*---------------------------------------------------------------------------*