Skip to Content
0
Former Member
Jul 03, 2009 at 03:14 AM

Error 'Document not sent' in sending email with attachment

918 Views

Hi,

I have a problem in sending email externally with excel attachment. I used FM SO_NEW_DOCUMENT_ATT_SEND_API1. However, It returns sy-subrc = 2 which is 'Document not sent'. Can you help me what causes this problem?

Below is my code.

CLEAR: i_receivers.

REFRESH i_receivers.

i_receivers-receiver = p_eadd.

i_receivers-rec_type = 'U'.

i_receivers-notif_del = 'X'.

i_receivers-notif_ndel = 'X'.

APPEND i_receivers.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = x_doc_data

put_in_outbox = 'X'

TABLES

packing_list = i_packing_list

contents_bin = i_attachment

contents_txt = i_message

receivers = i_receivers.

IF sy-subrc <> 0.

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

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

ENDIF.