cancel
Showing results for 
Search instead for 
Did you mean: 

sending smartform output by mail

Former Member
0 Kudos

Hi

My requirement is to send smartform output by mail to external mail ids to a given TO:,CC:,BCC: and subject. This smartform is getting triggered by a custom report and not by any standard transaction.

Please give me suggestions how to do this.

shailendra

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This actually quite easy to do with SMARTFORMs.  First you will want to fill the control_parameters exporting option for the call to your SMARTForms function module. You want to set the getotf field to 'X'. This will cause the function call to return the raw OTF data as part of the job_output_info importing parameter.

Example 1

if email = 'X'.

    control-getotf = 'X'.

    move 'X' to control-no_dialog.

  endif.

****Call the Smart Form generated function module

  move-corresponding job_output_options to output_options.

  call function fm_name

    exporting

  control_parameters = control

  output_options = output_options

      edidc = edidc

      header = header

  importing

    job_output_info = job_output_info

    job_output_options = job_output_options

    tables

      schedules = schedules[]

      htext = htext[]

      itext = itext[] .

You can then convert the OTF to PDF using function CONVERT_OTF and send it as a binary attachement using SO_NEW_DOCUMENT_ATT_SEND_API1.  There have been other posts on this forum that detail these steps. There are also some parameters to the SmartForms function call for Mail_appl_obj, mail_recipient, and mail_sender. I have never used these however, because I like the greater control that this approach gives you. Often I am generating more than one output that I want to separate into different file attachments on the same E-Mail.