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: 

Email not in inbox using SO_DOCUMENT_SEND_API1

siongchao_ng
Contributor
0 Kudos
1,445

Hi all,

I am using the FM shown below to send an email to my external yahoo inbox. When I run the program the sy-subrc = 0 and I will get a pop up box showing SAPConnect Send Process:List of Send Objects.

It shows Document title: Send Mail from ABAP Program

Rec: 1

SAP office Object ID : RAW37000000000027

Type: M

and a sign look like a thunder.

I clicked on the green check on the pop up box to continue.

When I checked my yahoo inbox, I did not receive any mail. May I know what is going on?

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = gd_doc_data

put_in_outbox = 'X'

sender_address = 'my yahoo email address'

sender_address_type = 'INT'

commit_work = 'X'

IMPORTING

sent_to_all = gd_sent_all

TABLES

packing_list = it_packing_list

contents_bin = lt_attachment

contents_txt = it_message

receivers = it_receivers

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.

  • Store function module return code

gd_error = sy-subrc.

  • Get it_receivers return code

LOOP AT it_receivers.

ENDLOOP.

  • Instructs mail send program for SAPCONNECT to send email(rsconn01)

WAIT UP TO 2 SECONDS.

IF gd_error EQ 0.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = 'X'

AND RETURN.

ENDIF.

Edited by: Siong Chao on Jan 11, 2012 9:44 AM

11 REPLIES 11

marcin_milczynski
Contributor
0 Kudos
434

Hi,

Do you have SMTP settings maintained for the system in SCOT? If yes, check is SOST if the mail is still in outboux - on test systems usually there is no background job sending mails out scheduled in SCOT .

Regards,

Marcin

0 Kudos
434

HI Marcin,

I went to SOST and fond there is error status there saying "Cannot process message, no route from A-0000017732 to my email address"

Further clarification:

Sender : my yahoo email address

Receiver: my yahoo email address

Is that okie with the email address? I am using the same email address. Would that be a problem particularly with the sender email?

What must I do next?

Edited by: Siong Chao on Jan 11, 2012 10:08 AM

0 Kudos
434

Yes, it seems the system does not have access to SMTP server. It's more common to assign there a no-reply e-mail in the company's domain, as the mail server usually is within the same LAN or router correctly.

You should check with your Basis consultant.

Regards,

Marcin

0 Kudos
434

You are getting that error because user Id you are using does not have an access to send emails out of the system.

Please contact the Basis team and ask them to provide necessery authorization inorder to enable sending of mails out of the system from that User id.

Regards,

Karuna

0 Kudos
434

SCOT setting are missing please ask your administrator to maintain them

Nabehet

0 Kudos
434

Follow up with basis to open SMTP connection for external send mails and get authorization for your userid .

surajarafath
Contributor
0 Kudos
434

Go to the Transaction SOST, and look for your mail there.

After that select your mail click the execute button. It will send.

Usually if it is a development system, mail settings will be like this. It will not send mail automatically.

Former Member
0 Kudos
434

Hi,

Maintain email address and type in it_receivers internal table instead of exporting parameters

Former Member
0 Kudos
434

Siong,

ask your basis team to maintain SCOT setting for sending external email from SAP.

And schedule background job for program RSCONN01.

If you are sending smartform pdf as an email attachment you can specify that setting in SCOT instead of using FM.

O/P format should be pdf for sapscript/smartform.

Thanks,

Pankaj

Former Member
0 Kudos
434

Hi dear,

Here am sending the which perfectly works . Place the below code and execute it.

parameters : LV_EMP_USERID TYPE FITP_USER-UNAME,

LV_EMP_EMAILID TYPE PA0105-USRID_LONG.

DATA:it_receivers TYPE STANDARD TABLE OF somlreci1,

wa_it_receivers LIKE LINE OF it_receivers,

it_packing_list TYPE STANDARD TABLE OF sopcklsti1,

gd_doc_data TYPE sodocchgi1,

wa_it_packing_list LIKE LINE OF it_packing_list,

psubject(90) TYPE c,

it_message TYPE STANDARD TABLE OF solisti1,

wa_it_message LIKE LINE OF it_message,

c1(99) TYPE c,

c2(15) TYPE c,

num_lines TYPE i.

FREE wa_it_receivers.

wa_it_receivers-receiver = lv_emp_emailid.

wa_it_receivers-rec_type = 'U'. "&---- Send to External Email id

wa_it_receivers-com_type = 'INT'.

wa_it_receivers-notif_del = 'X'.

wa_it_receivers-notif_ndel = 'X'.

APPEND wa_it_receivers TO it_receivers .

DESCRIBE TABLE it_receivers LINES num_lines.

"&--- Check the Sender Email id or SAP User id is got or not.

IF num_lines IS NOT INITIAL.

*&----


  • Add thetext to mail text table

*&----


&-- Subject of the mail -


&

psubject = 'Daily Activity'(001).

&-- Body of the mail -


&

CLEAR wa_it_message.

c1 = 'Dear Sir'(005).

*c2 = lv_emp_userid.

CONCATENATE c1 c2 ',' INTO

wa_it_message-line SEPARATED BY space.

APPEND wa_it_message TO it_message.

      • insert Blank Line *********************************************

CLEAR wa_it_message.

wa_it_message-line = ' '.

APPEND wa_it_message TO it_message.

              • Assign your Text below *************************************

CLEAR wa_it_message.

wa_it_message-line = 'A Timesheet sent from Ravi Seela.'(002).

APPEND wa_it_message TO it_message.

      • insert Blank Line{} *********************************************

CLEAR wa_it_message.

wa_it_message-line = ' '.

APPEND wa_it_message TO it_message.

**********Assign your Text below ********************************

CLEAR wa_it_message.

wa_it_message-line = 'This mail generate automatically. Please do not reply.'(003).

APPEND wa_it_message TO it_message.

gd_doc_data-doc_size = 1.

*Populate the subject/generic message attributes

gd_doc_data-obj_langu = sy-langu.

gd_doc_data-obj_name = 'SAPRPT'.

gd_doc_data-obj_descr = psubject.

gd_doc_data-sensitivty = 'F'.

*Describe the body of the message

CLEAR wa_it_packing_list.

REFRESH it_packing_list.

wa_it_packing_list-transf_bin = space.

wa_it_packing_list-head_start = 1.

wa_it_packing_list-head_num = 0.

wa_it_packing_list-body_start = 1.

DESCRIBE TABLE it_message LINES wa_it_packing_list-body_num.

wa_it_packing_list-doc_type = 'RAW'.

APPEND wa_it_packing_list TO it_packing_list.

data sent(1) type c.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = gd_doc_data

PUT_IN_OUTBOX = 'X'

SENDER_ADDRESS = 'your mail id' . "Your mail Id here

SENDER_ADDRESS_TYPE = 'INT'

COMMIT_WORK = 'X'

IMPORTING

SENT_TO_ALL = sent

  • NEW_OBJECT_ID =

  • SENDER_ID = sent

TABLES

PACKING_LIST = it_packing_list

  • OBJECT_HEADER =

  • CONTENTS_BIN =

CONTENTS_TXT = it_message

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

RECEIVERS = it_receivers

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 = 0.

SUBMIT RSCONN01 WITH MODE = 'INT' WITH OUTPUT = ' '.

ENDIF.

endif.

Hope this is helpful if any problem revert me back.

Regards,

G.Aditya

Harsh_Bansal
Contributor
0 Kudos
434

Hi,

I also faced similar situation few weeks back.

What you need to do is contact your BASIS team and ask them to maintain all the mail ids in SCOT.

They might ask for some approval.

Once it is done, then your mail will reach in your desired mailbox.

Regards,

Harsh Bansal