‎2010 Jun 22 12:47 PM
Can SO_DOCUMENT_SEND_API1 be used to send more than 1 attachment??
‎2010 Jun 22 12:51 PM
Yes. SO_DOCUMENT_SEND_API1 be used to send more than 1 attachment. Search SCN for examples.
‎2010 Jun 22 12:57 PM
Hi,
Sending multiple documents as attachements can be more easily done using OOPS. Go through the sample code below:
Also you can send the mails to multiple recipients, follow this code.
data: lref_send_request TYPE REF TO cl_bcs,
lref_document TYPE REF TO cl_document_bcs,
lref_recipient TYPE REF TO cl_cam_address_bcs,
TRY .
lref_send_request = cl_bcs=>create_persistent( ).
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
TRY .
lref_document = cl_document_bcs=>create_document(
i_type = c_doctype_raw
i_length = lv_pdf_size
i_subject = text-003 ). "#EC NOTEXT
CATCH cx_document_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
CONCATENATE c_billgrp c_file_split sy-datum sy-uzeit INTO lv_billing_doc.
TRY.
CALL METHOD lref_document->add_attachment
EXPORTING
i_attachment_type = c_doctype_txt
i_attachment_subject = lv_billing_doc
i_attachment_size = lv_pdf_size
i_att_content_hex = lt_binary_det. " Attachment for success record
CATCH cx_document_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
TRY.
CALL METHOD lref_send_request->set_document( lref_document ).
CATCH cx_document_bcs INTO oref.
lv_text = oref->get_text( ).
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
TRY.
CALL METHOD lref_send_request->set_message_subject
EXPORTING
ip_subject = lv_subject.
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
LOOP AT gt_email INTO gs_email.
TRY .
Add recipient (e-mail address)
create recipient object
lref_recipient = cl_cam_address_bcs=>create_internet_address( gs_email-email ).
"Email address of the user As parameter option
CATCH cx_address_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
TRY .
Add recipient object to send request
lref_send_request->add_recipient( lref_recipient ).
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
ENDLOOP.
TRY.
lref_send_request->set_send_immediately( c_x ).
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
TRY .
Send document
lv_sent_to_all = lref_send_request->send( i_with_error_screen = c_x ).
CATCH cx_send_req_bcs INTO oref.
lv_text = oref->get_text( ).
ENDTRY.
COMMIT WORK.
Regards,
Santosh Kumar Mukka.
‎2010 Jun 22 1:05 PM
Hi,
It is true that this FM can be used for more than one attachment.
Please visit these links for more information:
1. http://wiki.sdn.sap.com/wiki/display/Snippets/Multipleattachmenton+e_mail
May this helps you.
Regards.
Deepak Sharma
‎2010 Jun 22 4:37 PM
Please search before posting, do not ask or answer basic questions, do not post link farms.
Thread locked, points unassigned.
Thomas