Monday, August 6, 2012

Send SMARTFORM by email

You dont always have to read the OTF and then send email
instead use mail_sender params

Sending Forms by E-Mail or Telefax Locate the document in its SAP Library structure
Technical Background

To send forms by e-mail or telefax, SAP Smart Forms uses the Structure linkBusiness 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 Structure linkSAPconnect.
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.
Output Formats
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: Structure linkFormats in the documentation on Structure linkSAPconnect (BC-SRV-COM).
Sending Forms by E-Mail
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.
To ensure that SAP Smart Forms evaluates the e-mail parameters, you have to set the DEVICE parameter of the control structure to 'MAIL'.

See also Structure linkConnection to the Interface in the BCI documentation.
Additional Features with DEVICE='MAIL'
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.
Sending Forms by Telefax
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).

No comments:

Post a Comment