Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

Re: Regarding text attachment in Email in ABAP program

$
0
0

Hi,

 

Another option....

 

Some sample code using cl_bcs .

 

Note the use of cl_abap_char_utilities=>cr_lf .

 

FORM mail_1_prep_10

USING

    it_data         TYPE table

  CHANGING

    ob_document_bcs TYPE REF TO cl_document_bcs .

 

  DATA: txt_line TYPE string .

  DATA: txt_data TYPE string .

 

* Create some text data .

 

  DO 20 TIMES .

 

    txt_line = '' .

 

    DO 10 TIMES .

 

      CONCATENATE txt_line '|' 'some data 01' '|'   INTO txt_line .

 

    ENDDO .

 

    CONCATENATE txt_line cl_abap_char_utilities=>cr_lf INTO txt_line .

 

    CONCATENATE txt_data txt_line INTO txt_data .

 

  ENDDO .

 

* Mail stuf....

 

  DATA: it_solix TYPE solix_tab .

 

  CALL METHOD cl_bcs_convert=>string_to_solix

    EXPORTING

      iv_string = txt_data

    IMPORTING

      et_solix  = it_solix.

 

  DATA: attachment_subject TYPE so_obj_des .

  DATA: attachment_type TYPE so_obj_tp .

 

  attachment_subject = 'Some text data' .

  attachment_type = 'txt' .

 

  TRY.

      CALL METHOD ob_document_bcs->add_attachment

        EXPORTING

          i_attachment_type    = attachment_type

          i_attachment_subject = attachment_subject

          i_att_content_hex    = it_solix.

    CATCH cx_document_bcs .

  ENDTRY.

 

ENDFORM .                    "mail_1_prep_10

 

 

regards. 


Viewing all articles
Browse latest Browse all 9164

Trending Articles



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