You dont always have to read the OTF and then send email
instead use mail_sender params
Sending Forms by E-Mail or Telefax
To send forms by e-mail or telefax, SAP Smart Forms uses the Business Communication Interface (BCI). This interface allows application developers to implement sending of documents to internal and external communication partners. To send documents to external partners, the BCI forwards the send objects to SAPconnect.
At the interface of the generated function module, SAP Smart Forms provides parameters that are passed to the BCI (see: Parameters of the Generated Function Module). To fill these parameters, the application developer must be familiar with the functions of the BCI (see below).
Alternatively, you can do without any SAP Smart Forms support and let the form be returned in table form (OTF, XSF, XDF, or HTML). For more information, see: Returning a Form as a Table in the Application Program. In this case, you pass the form directly to the BCI or its successor, the BCS (Business Communication Services). SF_XSF_DEMO_MAIL is an example report that shows the sending of a Web form.
When sending a form, SAP Smart Forms always uses OTF format. However, you can specify in SAPconnect administration (transaction SCOT) for the supported address types of a node that SAP Smart Forms forms are to be converted (for example, to PDF) before they are sent.
This type of processing is identical to SAPscript. See also: Formats in the documentation on SAPconnect (BC-SRV-COM).
To send forms as e-mails using SAP Smart Forms, you have to fill the e-mail parameters of the generated function module:
- The parameters MAIL_SENDER and MAIL_RECIPIENT to pass the sender and the recipient of the document. To fill these parameters, you have to create the respective BOR objects of object type RECIPIENT and fill their attributes.
- The parameter MAIL_APPL_OBJ, which you use to link the application object with the sent document. You have to create a BOR object for this parameter too.
See also Connection to the Interface in the BCI documentation.
Even though the parameters MAIL_SENDER, MAIL_RECIPIENT, and MAIL_APPL_OBJ are primarily designed for sending e-mails, they also provide a general connection to the BCI. This means that you can use these parameters to address all the communication methods that the BCI supports.
To set the recipient type of the RECIPIENT object, use the TypeId attribute.
To send a form as a fax, you have to set the DEVICE parameter of the control structure to 'TELEFAX'. Instead of a spool dialog, SAP Smart Forms then starts a fax dialog, in which the user can enter a fax number. As with spool dialog, you can preassign values for these fields using the output options, and skip the dialog by setting the NO_DIALOG field in the control structure.
Alternatively, you can send a form as a fax using the BCI (DEVICE='MAIL', see above).