Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sending mail with TEXT attachment

marcela_martinez
Participant
0 Kudos
124
Hello everybody,
I have a problem with an email attachment.
In my program, I have to send an email with a text (.txt extension) attachment. For doing this they are using SO_DOCUMENT_SEND_API1 FM.
They are saying in the email configuration that it’s TXT format and RAW document type.
Each record at the end needs to have 72 blanks. When they receive the email with the attachment, each record ends in the last significant carácter, I mean that the 72 blanks are missing.
This is the piece of code that builds the attachment:
DATA: vl_subrc  TYPE sy-subrc VALUE 0.

  CLASS cl_abap_char_utilities DEFINITION LOAD.

 
CONSTANTS: cl_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
                          cl_cret
TYPE c VALUE cl_abap_char_utilities=>cr_lf.

  LOOP AT ti_mail INTO wa_mail.

      wa_attach-line = wa_mail.
     
APPEND wa_attach TO ti_attach.

ENDLOOP.
Where ti_mail and wa_mail have the following definition:
TYPES: BEGIN OF ty_line2,
              
line(160) TYPE c,
            
END OF ty_line2.
DATA: ti_mail  TYPE TABLE OF ty_line2,
            wa_mail 
TYPE ty_line2.
And wa_attach and ti_attach:
DATA: ti_attach       TYPE TABLE OF solisti1,
           wa_attach    TY
PE solisti1.
Do you know how to generate that attachment with the blanks at the end? I can’t define any caracter after them, only the blanks.
Thanks in advance and many kind regards.
1 ACCEPTED SOLUTION

marcela_martinez
Participant
0 Kudos
87
3 REPLIES 3

Former Member
0 Kudos
87

Hi,

Inside the loop try the code below:

wa_attach-line = wa_mail.

wa_attach-line+72 = cl_cret.

APPEND wa_attach TO ti_attach.

0 Kudos
87

Thanks Felipe, but I tried it before and it doesn't work.

I think that I find something to solve it. Qhen I get it I will let everybody know.

Thx & regards.

marcela_martinez
Participant
0 Kudos
88