2013 Apr 26 8:38 AM
Hi ABAPers,
Following FM is used to send e-mail with Excel attachment:
* Send email
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_packing_list
contents_bin = t_attachment
contents_txt = t_message
receivers = t_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.
I now like to get rid of the attachment, all trys have failed so far... Does this FM only support text e-mail AND attachment or is there a way to get rid of the attachment?
Thanks for your help guys.
Martin
2013 Apr 26 10:23 AM
Hi Martin,
You can use the class mentioned by Matthew or else go ahead with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the one you are using is obsolete.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = ls_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Hope this helps.
Regards,
Deepak.
2013 Apr 26 9:05 AM
Rather than this obsolete function module, use CL_BCS and associated classes. It's much more straightforward and powerful. There's plenty of information on this site about the use of these classes.
2013 Apr 26 9:12 AM
Hi Matthew,
Thanks, for your advice, but I just want to amend an existing program without a lot of effort. Ideally just deleting some code lines, that this Excel attachment is not being sent. Is there a possibility with this FM?
Thanks
2013 Apr 26 10:03 AM
Hi martin,
Follow the below link on using cl_bcs for sending mail
http://wiki.sdn.sap.com/wiki/display/Snippets/Send+email+from+ABAP+with+class+CL_BCS
thanks and regards,
narayan
2013 Apr 26 10:23 AM
Hi Martin,
You can use the class mentioned by Matthew or else go ahead with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the one you are using is obsolete.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = ls_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Hope this helps.
Regards,
Deepak.
2013 Apr 26 12:51 PM
Thanks Deepak,
I implemented the new one and fiddled around, that worked! Thanks also to the others for suggesting the "new way" with class.
Have a good day and weekend all!
Martin