Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sending Email

I have a requirement wherein I need to send mail to SAP business workplace. Let me know which function module can be used for this purpose. It would be grateful if a sample code is attached.

Tags:
replied

Pl. use the below code which will be useful.

report zmail.

data : maildata type sodocchgi1,

mailtxt type table of solisti1 with header line,

mailrec type table of somlrec90 with headerline.

start-of-selection.

clear : maildata, mailtxt, mailrec.

refresh : mailtxt, mailrec.

maildata-obj_name = 'TEST'.

maildata-obj_descr = 'Test'.

maildata-obj_langu = sy-langu.

mailtxt-line = 'Sending Mail'.

append mailtxt.

mailrec-receiver = 'xxxx@xxx.com'.

mailrec-rec_ty[e = 'U'.

append mailrec.

call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

document_data = maildata

document_type = 'RAW'

put_in_outbox = 'X'

tables

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

exceptions

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

others = 8.

Pl. award points if useful.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question