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: 

a question about mail attachment

Former Member
0 Kudos

Hi, everybody.

I have met a question about mail attachment in ABAP.

According to some weblog, I will use SO_DOCUMENT_SEND_API1 to send mail with attachement.

But my question is , if I want to attach a text file in the mail, should I convert it to a binary internal table, and pass it to the 'CONTENTS_BIN'?

I have read some sample which attach a PDF or HTML in mail, but if it is a text file, how can I do with it?

Is there any function module can convert a text file or string to binary format?

Any suggestion is welcome, and hope for your reply

thanks a lot

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos

Hi,

you can use fm to send normal text file:

  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            DOCUMENT_DATA              = DOC_CHNG
            PUT_IN_OUTBOX              = 'X'
       TABLES
            PACKING_LIST               = OBJPACK
            OBJECT_HEADER              = OBJHEAD
            CONTENTS_TXT               = OBJTXT"<-your itab
            RECEIVERS                  = RECLIST

regards Andreas

3 REPLIES 3

Former Member
0 Kudos

Hi,

Go through this linkhttp://www.sapdevelopment.co.uk/reporting/email/emailhome.htm

Thanks & Regards,

Judith.

andreas_mann3
Active Contributor
0 Kudos

Hi,

you can use fm to send normal text file:

  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            DOCUMENT_DATA              = DOC_CHNG
            PUT_IN_OUTBOX              = 'X'
       TABLES
            PACKING_LIST               = OBJPACK
            OBJECT_HEADER              = OBJHEAD
            CONTENTS_TXT               = OBJTXT"<-your itab
            RECEIVERS                  = RECLIST

regards Andreas

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Just try this.

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

i_tline TYPE TABLE OF tline WITH HEADER LINE,

v_len_in LIKE sood-objlen.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'TXT'

max_linewidth = 132

IMPORTING

bin_filesize = v_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Then try to convert the line size be 255 characters.Then attach it.

Check this link also.

http://www.sap-img.com/abap-function.htm