Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

I need Help on sending e-mail with attachments.

$
0
0

I have a report that should send an e-mail which contains e-mail body and attachment (HTML)

 

With some calculations i have Created an Internal Table  lets say lt_test ( this Table should be sent in attachment)

 

 

 

**************************************************************************************

* email part start*

**************************************************************************************

 

 

WRITE: /' E-mail body ', lv_var1.      " this variable is being taken from the above part pf the report

 

*************************

*** saving a List  which is used to create e-mail Body.

******************************

 

  CALL FUNCTION 'SAVE_LIST'
    EXPORTING
list_index         = sy-lsind
    TABLES
      listobject         = li_listobject
    EXCEPTIONS
      list_index_invalid = 1
      OTHERS             = 2.
  IF sy-subrc NE 0.
    RAISE invalid_list.
  ENDIF.

 

 

 

* Convert the list to ALI format
CALL FUNCTION 'TABLE_COMPRESS'
     TABLES
       in             = li_listobject
       out            = li_ali
     EXCEPTIONS
       compress_error = 1
       OTHERS         = 2.
  IF sy-subrc NE 0.
    RAISE compress_error.
  ENDIF.


...... the part where I am geting the e-mail adresses

 

 

 

lr_request = cl_bcs=>create_persistent( ).   """""" creating  request

      lr_document = cl_document_bcs=>create_document(                  """""""Here should be the Mail body
                          i_type      = 'ALI'
                          i_text      = li_ali
                          i_length    = lv_textlength
                          i_subject   = 'Test subject' ).    


     lr_document->add_attachment( i_attachment_type    = 'ALI'         """""""Here should tha attachment added to the E-mail.
                                i_attachment_subject = 'Test attachment'
                                i_att_content_hex    = (internal Table) ??????).

Result that i want.

 

Sending E-mail with text (e-mail Body) and with attachment the Internal table (lt_test)

Format of the attachment HTML or Excel.

 

Questions:

1) In which format and how should I convert the Internal table lt_test so that the attachment can be readable to the receiver ?

 

 

Thank you in advance for your answers.

 

Best Regards,

Erion.



Viewing all articles
Browse latest Browse all 8332

Trending Articles



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