Data definition
Have text ready for email body
Have internal table ready with
data for the attachment
Convert table data into a
binary stream
Set them email request subject
Create the email document
Attach the email document
to the email request
Create the email sender and set
the sender
Add the attachment to email
document
Send email request and commit
Example
Send an email using sample
content and an attachment. Check the email in SOST to verify.
steps to follow
Data definition
Define data set to be used
in the program. See program comment for details.
Have data/text ready for email
body
In this example, an internal
table will be populated with sample data for the email body.
Have an internal table ready
with attachment data
Have an internal table ready with attachment data Convert
internal table with attachment data into a binary stream
Collect internal table data to a variable type String.
Separate values by horizontal tab and add a new line character at the end of
each line
Set the email request subject
Two variables will be used in two different methods because
of different types
Create the email document
Determine the length of the email body (
In this example LT_CONTENTS internal table
). Document type is RAW and you may use a different type as
per your requirement. Parse email body table, determined length of the table,
document subject, language and importance of the message.
Set the email request attributes
Attach the email document
to the email request Create and set the email sender
Create and set the email
recipients
In this example sender
is the user who runs this program.
Parse the attachment
document extension, attachment name and the converted binary stream.
Create and set the email
recipients
Send the email request and commit workCheck the created email in the transaction SOST
Check the created email in the transaction SOST
No comments:
Post a Comment