Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Mail In SAP

Former Member
0 Kudos

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 ) 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

6 REPLIES 6

former_member212653
Active Contributor
0 Kudos

Go to transaction SOST to check if they are in queue or not.

Former Member
0 Kudos

Hi,

Go to transaction SCOT and check whether the mail is visible there and you can check the log as well.

Regards,

Raghavendra

Former Member
0 Kudos

Hi supriyo,

Check the SOST transaction and execute their the mail status.

Have you passed the email id .

CLEAR I_RECLIST.
I_RECLIST-RECEIVER = ' '.----> email id.
I_RECLIST-EXPRESS  = 'X'.
I_RECLIST-REC_TYPE  = 'U'.
APPEND I_RECLIST.

Regards,

Sravanthi

Former Member
0 Kudos

Hi Supriyo,

The function module 'SO_NEW_DOCUMENT_SEND_API1' has a importing parameter COMMIT_WORK. Pass the value for that as X

COMMIT_WORK = 'X'

Also check in SCOT or SOST as suggested by others.

Regards

Former Member
0 Kudos

hi in your case,

it seems to be external mail

so just you have configure in SCOT transaction

ie., smtp configuration needs to be done

and it will done by basis people

so contact them

Former Member
0 Kudos

dear guru ,

we don't try to send delivery via internet.

Message XS802 No delivery to XXXXX , as recipient unknown.

Can you help me ?

Thanks.