Hi Experts,
I'm trying to send mail using the send mail activity step in WF.
But instead of using method SENDTASKDESCRIPTION in BOR object SELFITEM,
I've created a copy of it and am using it, modifying the code to use FM SO_DOCUMENT_SEND_API1
instead of FM SWW_SRV_MAIL_SEND.
The main motive for doing this is to change the sender email id according to requirement.
The coding is exactly the same as in SENDTASKDESCRIPTION, except I've commented out
FM SWW_SRV_MAIL_SEND and used this below code:
****************************************************************************
* Fill the document data.
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 = documenttitle.
gd_doc_data-sensitivty = 'F'.
* Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
* Add the recipients email address
LOOP AT t_receivers_por INTO s_receivers_por.
CLEAR it_receivers.
REFRESH it_receivers.
it_receivers-receiver = s_receivers_por-objkey.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
APPEND it_receivers.
ENDLOOP.
* Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
sender_address = 'test@test.co.uk'
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_txt = document_content
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.
********************************************************************
But doing this I'm getting an 'Exception 1006'.
Can anybody help me figure out what I'm doing wrong?
Thanks,
BK