0% found this document useful (0 votes)
358 views

ABAP Send Email Using BCS

Example ABAP Code to send email using BDS. This example will allow you to send email with an attachment and using HTML format

Uploaded by

Endy Limantara
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
358 views

ABAP Send Email Using BCS

Example ABAP Code to send email using BDS. This example will allow you to send email with an attachment and using HTML format

Uploaded by

Endy Limantara
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

data: ld_subject lt_receiver ld_receiver ld_len lo_mime_helper lo_bcs lo_doc_bcs lo_recipient lt_soli lt_solix d_body t_pdf

type type type type type type type type type type type type

char50, table of ad_smtpadr, ad_smtpadr, so_obj_len, ref to cl_gbt_multirelated_service, ref to cl_bcs, ref to cl_document_bcs, ref to if_recipient_bcs, soli_tab, solix_tab, string, xstring.

call function 'SWA_STRING_TO_TABLE' exporting character_string = d_body importing character_table = lt_soli[]. call function 'SCMS_XSTRING_TO_BINARY' exporting buffer = t_pdf tables binary_tab = lt_solix. create object lo_mime_helper. call method lo_mime_helper->set_main_html exporting content = lt_soli. ld_len = 0. call method lo_mime_helper->add_binary_part exporting content = lt_solix filename = 'Test.pdf' extension = 'PDF' content_type = 'application/bmp' length = ld_len content_id = 'rest'. call method cl_document_bcs=>create_from_multirelated exporting i_subject = ld_subject i_multirel_service = lo_mime_helper receiving result = lo_doc_bcs. call method cl_bcs=>create_persistent receiving result = lo_bcs. call method lo_bcs->set_document exporting i_document = lo_doc_bcs. loop at lt_receiver into ld_receiver. lo_recipient = cl_cam_address_bcs=>create_internet_address( i_address_string = ld_receiver ). call method lo_bcs->add_recipient exporting i_recipient = lo_recipient i_express = 'X'. endloop. call method lo_bcs->set_send_immediately exporting i_send_immediately = 'X'.

call method lo_bcs->send. commit work.

You might also like