You can trigger sending of the PDF form inside the application program or via an e-mail button in the form layout.
Both methods will be shown in the next figures.
Package SBCOMS contains useful example programs on sending e-mails via the BCS classes. Therefore, object-oriented knowledge is required.
This figure shows some of the relevant BCS classes and their methods for sending e-mail.
The most important method is “SENT” inside the class CL_BCS.
Class CL_SAPUSER_BCS is used to create an internal SAP user as object. It can then be used as recipient.
Method ADD_RECEPIENT of CL_BCS passes the recipient object over to the send request.
With the class CL_CAM_ADDRESS_BCS, an external Internet user and his e-mail address can be created as object and passed two.
The figure above shows the statements to create and send an e-mail.
In this example, the receiver is an external Internet user. You can use transaction SOST to monitor send requests that are passed to the Internet.
An alternative to the BCS-methods is the function call SO_NEW_DOCUMENT_ATT_SEND_API1. You can use this function call to send PDF forms via e-mail.
To search for examples, just try the “where-use-list”!
If the user should be enabled to send the PDF form via a button in the layout, create a button and switch the Control-Type radio button to Submit. This evokes a new Submit tab page.
In the Submit tab page, in the Submit to URL field, the developer can preset an e-mail address for the receiver.
Of course, you can also do this dynamically with scripting:this.resolveNode(“#event.#submit”).target = “mailto:user@sap.com”;