Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Using xml sending E-mails.

$
0
0

I propose one more way to send xml messages from XI as a PDF attachment that does not exploit spool. It can be easy to use and probably be handy too.

Pre-Requsite: SAPConnect has to be configured appropriately on SAP XI.
Validity : If you are using WAS >=6.10 AND WAS <6.40 then implement the note 633265.For WAS>=6.40 note need not be implemented.
Settings to be done in SCOT :Double click the SMTP node in the SCOT transaction and set the internet address as shown below.
Set Internet Address
Set the output format of SAP for RAW Text as PDF .
Set Raw Text
Create RFC: Create RFC YXI_SEND_MAIL_ PDF_ATT in SE37 with the following parameters and source code:
Import Parameters :
SUBJECT type SO_OBJ_DES //Subject of the Mail
ATTACH_NAME1 type SOOD-OBJDES //Attachment Name
Tables Parameter :
IT_CONTENT type SOLI_TAB //Content of the Mail
IT_ATTACH type SOLI_TAB //Attachment data that has to be sent in PDF Format

 

 

source code use:

 

 

<span>function yxi_send_mail_pdf_att.*"----------------------------------------------------------------------*"*"Local Interface:*"  IMPORTING*"     VALUE(SUBJECT) TYPE  SO_OBJ_DES OPTIONAL*"     VALUE(ATTACH_NAME1) TYPE  SOOD-OBJDES OPTIONAL*"  TABLES*"      IT_CONTENT TYPE  SOLI_TAB OPTIONAL*"      IT_ATTACH TYPE  SOLI_TAB OPTIONAL*"----------------------------------------------------------------------  data: send_request       type ref to cl_bcs.  data: document           type ref to cl_document_bcs.  data: sender             type ref to cl_sapuser_bcs.  data sendername like sy-uname.  data: recipient          type ref to if_recipient_bcs.  data: exception_info     type ref to if_os_exception_info,  bcs_exception      type ref to cx_document_bcs.  data i_attachment_size type sood-objlen.  data spoolid type ref to tsp01-rqident.  data tline like tline occurs 0 with header line.* Creates persistent send request  send_request = cl_bcs=>create_persistent( ).  try.******Create txt mail document***************************      document = cl_document_bcs=>create_document(                                    i_type    = 'HTM'                                    i_text = it_content[]                                    i_subject = subject ).*************************************************************************Creates Attachment 1************************      call method document->add_attachment        exporting          i_attachment_type    = 'RAW'          i_attachment_subject = attach_name1          i_att_content_text =  it_attach[].* Add document to send request      call method send_request->set_document( document ).* Get sender object      sender = cl_sapuser_bcs=>create( sy-uname ).* Add sender      call method send_request->set_sender        exporting          i_sender = sender.************e-mail list**************************        translate it_recv-mailid to lower case.      recipient = cl_cam_address_bcs=>create_internet_address(     </span><a class="jive-link-email-small" href="mailto:'sravya.talanki@uk.ngrid.com">'sravya.talanki@uk.ngrid.com</a><span>').      call method send_request->add_recipient        exporting          i_recipient  = recipient          i_express    = 'U'          i_copy       = ' '          i_blind_copy = ' '          i_no_forward = ' '.***********Trigger e-mails immediately*****************************      send_request->set_send_immediately( 'X' ).      call method send_request->send( ).      commit work.    catch cx_document_bcs into bcs_exception.  endtry.endfunction.</span>

 

 

That is all! Test this using SE37 editor by passing sample content and attachment data and check whether you are able to view the PDF in your mail box before you configure a scenario in Integration Builder. We are ready to trigger XML messages as e-mails in the PDF format. Just map this RFC message to the XML message that has to be sent as an email from the integration repository. Map the content of mail to the node IT_CONTENT and attachment data to the node IT_ATTACH in the message mapping.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>