Skip to Content
0
Former Member
Sep 08, 2010 at 12:03 PM

Mail not going thru SO_DOCUMENT_SEND_API1

316 Views

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