Hi All,
In newer versions of SAP (newer than 6.10 release) best practice is to send emails using BCS interface instead of API1 interface. BCS interface is easier to use than the older API1 interface. Plus you are not required to fill the packing list which makes it less complicated.
These function modules can be used to send email in older versions.
- SO_DOCUMENT_SEND_API1
- SO_NEW DOCUMENT_ATT_SEND_API1
- SO_NEW_DOCUMENT_SEND_API1
These functions could be replaced by ABAP class CL_BCS (Business Communication Service).
These FMs queue email requests under SOST (SAPconnect Send Requests). SOST queued emails can be send using program RSCONN01 (SAPconnect: Start Send Process).
Set correct parameters such that you do not send out unwanted messages and affect the performance of the servers.
Also these messages can be sent manually using transaction SOST.
When using class CL_BCS to send emails there are few basic steps which should be considered. Depending on the email format and attachment type parameter should be set differently.
In the shown example email is send in HTML format with a text file (.txt) attachment. Email subject, body, recipient email and text for attachment are given in the selection screen.
As we are using HTML email format, body text in selection should be converted to HTML format. When attaching TXT or any other attachments to email, attached data should be converted to "SOLIX" format which is accepted by BCS class. Attachments can be text files, PDF files, world documents etc.
- Setting subject, HTML email body and initializing.
- Converting attachment string to xstring, converting xstring to SOLIX format and calculating attachment size.
- Adding email recipients and finally pushing the email to SOST.
SOST
SAP, ABAP, CL_BCS. SAP 6.10, SOST, send emails, xstring, string to xstring, bcs, attach file, attach text, attach PDF, send email, HTML, SO_DOCUMENT_SEND_API1, email API, Isuru Fernando, Object Oriented, OO, ABAP OO
Labels: ABAP, attach file, attach PDF, attach text, bcs, CL_BCS. SAP 6.10, email API, HTML, Isuru Fernando, SAP, send email, send email with sap, send emails, SO_DOCUMENT_SEND_API1, SOST, string to xstring, xstring