Skip to Content
0
Former Member
Oct 24, 2012 at 01:26 PM

Issue in Email with attachment

168 Views

hi All

I have written one report to send email with XL attachment, that time my system status was EHP5 FOR SAP ERP 6.0

But now system upgraded to EHP6 FOR SAP ERP 6.0. When I test email functionality, we are receiving email with attachment but not seeing any content in that.

I have used the below code to send Email with XL attachment. Please help on what is the issue in EHP6 FOR SAP ERP 6.0.

send_request = cl_bcs=>create_persistent( ).

refresh: it_objtxt.

append initial line to it_objtxt assigning <wa_objtxt>.
<wa_objtxt> = text-011.

* -------- create and set document with attachment ---------------
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = it_objtxt
* i_length = '12'
i_subject = text-012 ).

attachment = cl_document_bcs=>create_document(
i_type = 'XLS'
i_text = it_attach
i_subject = 'Test Email' ).

* add (existing) attachment to main document
call method document->add_document_as_attachment
exporting
im_document = attachment.

* add document to send request
call method send_request->set_document( document ).

v_email = lv_email.
recipient = cl_cam_address_bcs=>create_internet_address(
v_email ).

* add recipient with its respective attributes to send request
call method send_request->add_recipient
exporting
i_recipient = recipient
i_express = 'X'.

* mail for which status (E= only errors)
call method send_request->set_status_attributes(
i_requested_status = 'E'
i_status_mail = 'E').

* ---------- send document ---------------------------------------
call method send_request->set_send_immediately
exporting
i_send_immediately = 'X'.

call method send_request->send(
exporting
i_with_error_screen = 'X'
receiving
result = sent_to_all ).

commit work.
clear it_objtxt.