Skip to Content
0
Former Member
Jul 22, 2009 at 10:52 AM

Problem with TXT file with row length > 128 as email attachment

94 Views

Hi all,

I have a little bit a problem with sending TXT file as attachment. If there is row length > 128 then file isn't appeared in notepad correctly. Where I do any misteakes. See on my test code please. Thanks.

 
 REPORT test.

PARAMETERS: p_email(45) LOWER CASE.

START-OF-SELECTION.

  PERFORM send_list.
  

FORM send_list.
  DATA: it_attachment     LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        it_attachment_xls LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        it_attachment_txt LIKE solisti1 OCCURS 0 WITH HEADER LINE.

  CLASS cl_abap_char_utilities DEFINITION LOAD.
  DATA:
      con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
      con_cret(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.


  REFRESH: it_attachment,it_attachment_txt.
  REFRESH: it_attachment_xls.

  DATA: BEGIN OF st,
        f1(2) TYPE n,
        f2(20) TYPE c,
        f3(20) TYPE c,
        f4(20) TYPE c,
        f5(20) TYPE c,
        f6(20) TYPE c,
        f7(20) TYPE c,
        END OF st.

  DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,
        itab2 LIKE TABLE OF st WITH HEADER LINE.

  DO 3 TIMES.
    CLEAR itab1.
    itab1-f1 = sy-index.
    itab1-f2 = 'AAAAAAAAAAAAAAAAAAAAAA'.
    itab1-f3 = 'BBBBBBBBBBBBBBBBBBBBBB'.
    itab1-f4 = 'CCCCCCCCCCCCCCCCCCCCCC'.
    itab1-f5 = 'DDDDDDDDDDDDDDDDDDDDDD'.
    itab1-f6 = 'EEEEEEEEEEEEEEEEEEEEEE'.
    itab1-f7 = 'FFFFFFFFFFFFFFFFFFFFFF'.

    APPEND itab1.
  ENDDO.

  DO 5 TIMES.
    CLEAR itab2.
    itab2-f1 = sy-index.
    itab2-f2 = 'UUUUUUUUUUUUUUUUUUUUUU'.
    itab2-f3 = 'VVVVVVVVVVVVVVVVVVVVVV'.
    itab2-f4 = 'WWWWWWWWWWWWWWWWWWWWWW'.
    itab2-f5 = 'XXXXXXXXXXXXXXXXXXXXXX'.
    itab2-f6 = 'YYYYYYYYYYYYYYYYYYYYYY'.
    itab2-f7 = 'ZZZZZZZZZZZZZZZZZZZZZZ'.

    APPEND itab2.
  ENDDO.  

Thanks for help.

Edited by: Martin Filipczyk on Jul 22, 2009 1:45 PM