Mailversand über Smart Forms

Aus SAP-Wiki
Wechseln zu: Navigation, Suche

Mails lassen sich über die Standardschnittstelle beim Aufruf des Smart Forms füllen und das Formular sorgt dann für den Versand.

* Data-Anweisungen
  DATA: ls_control_param      TYPE ssfctrlop.
  DATA: ls_composer_param     TYPE ssfcompop.
  DATA: ls_recipient          TYPE swotobjid.
  DATA: ls_sender             TYPE swotobjid.

* Füllen Sender- und Mailempfänger
  PERFORM set_print_param USING    ls_addr_key
                          CHANGING ls_control_param
                                   ls_composer_param
                                   ls_recipient
                                   ls_sender
                                   cf_retcode.
* Form-Routine
  FORM set_print_param USING    is_addr_key LIKE addr_key
                       CHANGING cs_control_param TYPE ssfctrlop
                                cs_composer_param TYPE ssfcompop
                                cs_recipient TYPE  swotobjid
                                cs_sender TYPE  swotobjid
                                cf_retcode TYPE sy-subrc.

  DATA: ls_itcpo     TYPE itcpo.
  DATA: lf_repid     TYPE sy-repid.
  DATA: lf_device    TYPE tddevice.
  DATA: ls_recipient TYPE swotobjid.
  DATA: ls_sender    TYPE swotobjid.

  lf_repid = sy-repid.

  CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
    EXPORTING
      pi_nast       = nast
      pi_addr_key   = is_addr_key
      pi_repid      = lf_repid
    IMPORTING
      pe_returncode = cf_retcode
      pe_itcpo      = ls_itcpo
      pe_device     = lf_device
      pe_recipient  = cs_recipient  "Mail-Empfänger
      pe_sender     = cs_sender.    "Mail-Sender
  ENDFORM.
* Übertragen Mailbetreff an Feld der Schnittstelle, was für den Mailbetreff zuständig ist
  ls_composer_param-tdtitle = lv_mailbetreff.

*   call smartform delivery note
    CALL FUNCTION lf_fm_name
      EXPORTING
        archive_index        = ls_toa_dara
        archive_index_tab    = lt_toa_dara
        archive_parameters   = ls_arc_params
        control_parameters   = ls_control_param
*       mail_appl_obj        =
        mail_recipient       = ls_recipient
        mail_sender          = ls_sender
        output_options       = ls_composer_param