Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sending email with txt file attachment with more than 1100 character line

Hi All,

I would like to send  Internal table  in text file without any separator. and maintaining position of each field. Total length of line is 1103 character.

I had tried below method to achieve the same but file is appearing as attached in message.I like to attache this file to mail. i am using cl_bcs for sending mail.

constants: c_cr  TYPE c           VALUE  cl_abap_char_utilities=>cr_lf.

data: lv_line TYPE string.

    

       LOOP AT it_output INTO wa_output.

         lv_line = wa_output.                   " wa_output length is 1103 character

         if l_line is INITIAL.

           l_line = lv_line.

         else.

         CONCATENATE l_line lv_line  INTO l_line  SEPARATED BY c_cr.        

         endif.

         CLEAR: wa_output,lv_line.

       ENDLOOP.

 

TRY.

           cl_bcs_convert=>string_to_solix(

           EXPORTING

           iv_string = l_line

           iv_codepage = '4103' "suitable for MS Excel, leave empty

           iv_add_bom = 'X' "for other doc types

           IMPORTING

           et_solix = gt_binary_content

           ev_size = gv_size ).

*

**

*

         CATCH cx_bcs.

           MESSAGE e445(so).

       ENDTRY.

l_attcdoctype = 'BIN'.".c_ext.

       l_atttitle = 'Test_file'.

       DESCRIBE TABLE gt_binary_content LINES l_num_rows.

       gv_size = l_num_rows * 255.

* Create Document

       CALL METHOD l_document->add_attachment(

         i_attachment_type = l_attcdoctype

         i_attachment_subject = l_atttitle

         i_attachment_size = gv_size

         i_att_content_hex = gt_binary_content ).

Please let me know if i am missing anything.

Regards,

Hardik

test2.TXT.zip (1925 B)
Former Member
Not what you were looking for? View more on this topic or Ask a question