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: 

how to get the status of email

Former Member
0 Kudos

after sending mail using SO_DUCUMENT_SEND_API1 function module from sap to non-sap mail ids.How to get the status of email whether it is delivered or not.

7 REPLIES 7

Manohar2u
Active Contributor
0 Kudos

There will be a send status of your outbox mail.

Open the mail from outbox and check in receipient list tab to know the status.

Regds

Manohar

Former Member
0 Kudos

Use transactions

SCON

SCOT

SOST

SOSV

-Kiran

former_member181962
Active Contributor
0 Kudos

You can check the field RETRN_CODE

of the tables parameter RECEIVER.

regards,

ravi

Former Member
0 Kudos

hi subha,

check this..

REPORT Zxxxx .

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.

  • Creation of the document to be sent

  • File Name

DOC_CHNG-OBJ_NAME = 'SENDFILE'.

  • Mail Subject

DOC_CHNG-OBJ_DESCR = 'Send test Mail'.

  • Mail Contents

OBJTXT = 'HELLO'.

APPEND OBJTXT.

OBJTXT = 'THIS IS THE FIRST TEST MAIL'.

APPEND OBJTXT.

OBJTXT = 'have a good day'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

**attachment

OBJBIN-LINE = 'this is the first document'.

APPEND OBJBIN.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

CLEAR OBJPACK-TRANSF_BIN.

*OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

*OBJPACK-BODY_NUM = 1.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'Mail'.

OBJPACK-OBJ_DESCR = 'First Mail'.

OBJPACK-DOC_SIZE = 1 * 255.

APPEND OBJPACK.

  • Creation of the entry for the compressed document

*CLEAR OBJPACK-TRANSF_BIN.

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

*OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-BODY_NUM = 1.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = 'Attached Document'.

OBJPACK-DOC_SIZE = 1 * 255.

APPEND OBJPACK.

**Creation of the document attachment

    • (Assume that the data in OBJBIN is in BMP format)

*CLEAR OBJPACK-TRANSF_BIN.

OBJBIN = ' \O/ '. APPEND OBJBIN.

OBJBIN = ' | '. APPEND OBJBIN.

OBJBIN = ' / \ '. APPEND OBJBIN.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'Ram149_jpg.jpg'.

APPEND OBJHEAD.

    • Creation of the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'JPG'.

OBJPACK-OBJ_NAME = 'PICTURE'.

OBJPACK-OBJ_DESCR = 'Picture'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • Completing the recipient list

RECLIST-RECEIVER = 'email-id'

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

TABLES

PACKING_LIST = OBJPACK

OBJECT_HEADER = OBJHEAD

CONTENTS_BIN = OBJBIN

CONTENTS_TXT = OBJTXT

RECEIVERS = RECLIST

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

<b>CASE SY-SUBRC.</b>

WHEN 0.

WRITE: / 'Result of the send process:'.

LOOP AT RECLIST.

WRITE: / RECLIST-RECEIVER(48), ':'.

IF RECLIST-RETRN_CODE = 0.

WRITE 'The document was sent'.

ELSE.

WRITE 'The document could not be sent'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: / 'No authorization for sending to the specified number',

'of recipients'.

WHEN 2.

WRITE: / 'Document could not be sent to any recipient'.

WHEN 4.

WRITE: / 'No send authorization'.

WHEN OTHERS.

WRITE: / 'Error occurred while sending'.

ENDCASE.

hope this helps,

do reward if it helps,

priya.

former_member223537
Active Contributor
0 Kudos

Hi,

By return code you can get the intial errors. But if sy-subrc is returned as ZERO, still it is not assured that the mail has been delivered.

Programmatically its not possible to say it with assurance that mail has been delivered merely by checking sy-subrc = 0.

Through transaction SCOT you can check whether the mailing is having waiting to be delivered status or it has been delivered.

The mail could be in the network, showing waiting status through SCOT transaction when it has network load.

Best regards,

Prashant

Message was edited by: Prashant Patil

former_member188685
Active Contributor
0 Kudos

hi,

call function 'SO_DOCUMENT_SEND_API1'
...
...
....
if sy-subrc = 0.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
message mail sent.........
endif.

Regards

Vijay

Former Member
0 Kudos

Hi,

Once the mail is sent from R/3 , you can only get the status of the mail whether it is sent successfully from R/3 or not. You can see the status in Transaction SOST.

Once the mail is pushed out of R/3 , it is some mail server which actually delivers the mails to the external email IDs (Non SAP email IDs). The mail servers have features of sending mails back to the sender giving the delivery status of the mail.

This needs some settings in mail server and R/3 . You may please explore this. The responsibility of mail server and R/3 servers would be as follows.

1. Mail server : Send the delivery status of the mail sent from R/3 back to R/3.

2. R/3 : Recieve the mail and save it in the inbox.

Hope this helps you..

Regards,

Laxman Nayak.