Skip to Content

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

Send Mail In SAP

I am trying to send mail from SAP R3 to an email address. I am using the function module SO_NEW_DOCUMENT_SEND_API1 to send the mail. The function Module is giving a return code 0 which means the mail has been sent.. but the users are not getting the mail.

I am attachin the piece of code for your info

Pls help.

s_doc_chng-obj_descr = text-020.

s_doc_chng-sensitivty = 'F'.

s_doc_chng-obj_langu = sy-langu.

s_doc_chng-no_change = 'X' .

s_doc_chng-expiry_dat = sy-datum + 30.

LOOP AT it_supervisor1 INTO s_supervisor1.

Population Of Email Ids Of The Receivers in the internal table

Population Of Employees Email Id.

s_reclist = s_supervisor1-userid_long.

s_reclist-rec_type = 'U'.

APPEND s_reclist TO it_reclist.

CLEAR s_reclist.

Population Of Supervisors Email Id

s_reclist = s_supervisor1-suserid_long.

s_reclist-rec_type = 'U'.

APPEND s_reclist TO it_reclist.

CLEAR s_reclist.

Population Of Personal Specialist Email Id

s_reclist = s_supervisor1-psuserid_long.

s_reclist-rec_type = 'U'.

APPEND s_reclist TO it_reclist.

CLEAR s_reclist.

Population Of The Email Text

CONCATENATE text-004 s_supervisor1-ename

text-005 INTO lv_mail SEPARATED BY space.

s_objbin-line = lv_mail.

APPEND s_objbin TO it_objbin.

CLEAR: s_objbin, lv_mail.

CONCATENATE text-006 s_supervisor1-fwocd INTO lv_mail

SEPARATED BY space.

s_objbin-line = lv_mail.

APPEND s_objbin TO it_objbin.

lv_dat1 = s_supervisor1-expid(4).

lv_dat2 = s_supervisor1-expid+4(2).

CONCATENATE lv_dat2

s_supervisor1-expid+6(2)

lv_dat1

INTO lv_dat3 SEPARATED BY '/'.

CLEAR: s_objbin, lv_mail.

CONCATENATE text-007 lv_dat3 INTO lv_mail

SEPARATED BY space.

s_objbin-line = lv_mail.

APPEND s_objbin TO it_objbin.

CLEAR: s_objbin, lv_mail.

CONCATENATE text-008

s_supervisor1-psename

text-009 INTO lv_mail SEPARATED BY space.

s_objbin-line = lv_mail.

APPEND s_objbin TO it_objbin.

CLEAR s_objbin.

s_objbin-line = text-010.

APPEND s_objbin TO it_objbin.

Sending Of Email

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = s_doc_chng

document_type = 'BIN'

put_in_outbox = 'X'

TABLES

object_content = it_objbin

receivers = it_reclist

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.

IF sy-subrc ne 0.

message I001(00) with text-I05.

Mail Not Sent

exit.

ENDIF.

ENDLOOP.

Helpful answers will be awarded with good points

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question