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: 

Mail not going thru SO_DOCUMENT_SEND_API1

Former Member
0 Kudos

Hi All,

I need to send a mail to external mail ids so im using SO_DOCUMENT_SEND_API1 FM .

Message sent successfully to SAP outbox not receipinent ids'

Can you please guide anything im missed out parameters.

DATA: WA_DOCDATA LIKE SODOCCHGI1,

L_CNT TYPE I,

IT_PACKINGLIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,

IT_MAILTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

IT_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.

WA_DOCDATA-OBJ_DESCR = 'Test'.

WA_DOCDATA-OBJ_NAME = 'Mail'.

REFRESH IT_MAILTXT.

CLEAR IT_MAILTXT.

IT_MAILTXT-LINE = 'Hi Guyseererere'.

APPEND IT_MAILTXT.

DESCRIBE TABLE IT_MAILTXT LINES L_CNT.

IT_RECEIVERS-RECEIVER = id of the receiver

IT_RECEIVERS-REC_TYPE = 'U'.

IT_RECEIVERS-EXPRESS = 'X'.

APPEND IT_RECEIVERS.

CLEAR IT_RECEIVERS.

IT_PACKINGLIST-TRANSF_BIN = SPACE.

IT_PACKINGLIST-HEAD_START = 1.

IT_PACKINGLIST-HEAD_NUM = 0.

IT_PACKINGLIST-BODY_START = 1.

IT_PACKINGLIST-BODY_NUM = L_CNT.

IT_PACKINGLIST-DOC_TYPE = 'RAW'.

APPEND IT_PACKINGLIST.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = WA_DOCDATA

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

TABLES

PACKING_LIST = IT_PACKINGLIST

CONTENTS_TXT = IT_MAILTXT

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.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*ENDIF.

IF SY-SUBRC EQ 0.

COMMIT WORK.

SUBMIT RSCONN01 WITH MODE = 'INT'

AND RETURN.

WRITE 'sent successfully'.

ENDIF.

Regards

SK

7 REPLIES 7

jj
Active Contributor
0 Kudos

Check in transaction SOST, what is the status of this mail.

Former Member
0 Kudos

Hi John,

Im not seen any status for this mail.

I have deleted all entries in SOST and ran my program.

Mail status is Green in SAP OUTBOX and no entry in SOST.

Please help me how to resolve this issue

Former Member
0 Kudos

If you want to use this method (instead of BCS class), see SAP Note 609696 for working code samples/documentation for how these APIs work.

Former Member
0 Kudos

Hi Shaik,

put below line after call function 'SO_DOCUMENT_SEND_API1'.

submit rsconn01 with mode = 'INT' and return.

This will trigger the pending mail from SOST transaction.

Hope it will help.

Thanks & regards

Satyamkumar Jha

0 Kudos

Hi Satya,

I have already used the submit program after FM and Commit work.

0 Kudos

I dont see anythign wrong with ur code and was able to successfully send with your code. Is the INT active in SCOT in your system?

0 Kudos

I dont understand what is missing from Basis end.

Can you please tell me what all the Bais settings we need to do for sending mails.

I know SCOT & SOST tcodes.

After executing program, message status is successfull in SAP outbox and no entry in SOST.

Please suggest.