on 09-16-2014 2:11 PM
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
Hello,
There's no need to copy SENDTASKDESCRIPTION. I usually create a new method and do a simple call to fm SO_NEW_DOCUMENT_ATT_SEND_API1. Check if it allows you to change the sender.
regards
Rick Bakker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check the link 'Sending Mails - Home Page - ABAP Development - SCN Wiki'
Hi Biswa,
Why not you have created a fresh method with simple mail sending code , by using require importing parameter in place of using copy of sendiscription method ? Anyways I will also suggest please execute the business object (Method) manually in debug mode and try to analyse the error by reading sy-msgid and sy-msgno.
BR,
Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Biswanil
Exception (EXIT_RETURN ) 1006 is executed in sendtaskdescription when the mail FM (SO_DOCUMENT_SEND_API1) issues exception cx_swf_run_wim .... but take a close look in the code, the exception is caught using CATCH cx_swf_run_wim INTO lv_excp .
You can code to get the text of this exception using lv_excp->GET_TEXT or lv_excp->GET_LONGTEXT to know wxactly what is going wrong.
Do you also try to debug this step? Its a great way to find out the issue yourself. Maybe test@test.co.uk is a fake ID which is being rejected.
regards,
Modak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.