Skip to Content

Sending email with attachment SO_DOCUMENT_SEND_API1, chinese Charactors

Hi all,

Using SO_DOCUMENT_SEND_API1 to send an email with attachment of an xls file, those chinese charactors cant be written properly into the xls file. During my debug proccess, those chinese charactors seems fine, look good in the internal table. But the xls file received, those chinese charactors changed into weird charactors....

Thank you....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 16, 2006 at 11:59 PM

    SO_DOCUMENT_SEND_API1

    Can this function send the attachment in txt file? any website to show the example?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 17, 2006 at 07:47 AM

    Hai Kokwei Wong

    Check the following Code

    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

    DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

    DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

    DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

    DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

    DATA: DOC_CHNG LIKE SODOCCHGI1.

    DATA: TAB_LINES LIKE SY-TABIX.

    DATA L_NUM(3).

    • Creation of the document to be sent

    • File Name

    DOC_CHNG-OBJ_NAME = 'SENDFILE'.

    • Mail Subject

    DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.

    • Mail Contents

    OBJTXT = 'Object text'.

    APPEND OBJTXT.

    DESCRIBE TABLE OBJTXT LINES TAB_LINES.

    READ TABLE OBJTXT INDEX TAB_LINES.

    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

    • Creation of the entry for the compressed document

    CLEAR OBJPACK-TRANSF_BIN.

    OBJPACK-HEAD_START = 1.

    OBJPACK-HEAD_NUM = 0.

    OBJPACK-BODY_START = 1.

    OBJPACK-BODY_NUM = TAB_LINES.

    OBJPACK-DOC_TYPE = 'RAW'.

    APPEND OBJPACK.

    • Creation of the document attachment

    LOOP AT ITAB_DATA.

    CONCATENATE ITAB_DATA-PRODUCTOR

    ITAB_DATA-VBELN

    ITAB_DATA-POSNR

    ITAB_DATA-MATNR INTO OBJBIN.

    APPEND OBJBIN.

    ENDLOOP.

    DESCRIBE TABLE OBJBIN LINES TAB_LINES.

    OBJHEAD = 'ORDERS'.

    APPEND OBJHEAD.

    • Creation of the entry for the compressed attachment

    OBJPACK-TRANSF_BIN = 'X'.

    OBJPACK-HEAD_START = 1.

    OBJPACK-HEAD_NUM = 1.

    OBJPACK-BODY_START = 1.

    OBJPACK-BODY_NUM = TAB_LINES.

    OBJPACK-DOC_TYPE = 'TXT'.

    OBJPACK-OBJ_NAME = 'WEBSITE'.

    OBJPACK-OBJ_DESCR = 'ORDERS.TXT'.

    OBJPACK-DOC_SIZE = TAB_LINES * 255.

    APPEND OBJPACK.

    • Completing the recipient list

    • target recipent

    clear RECLIST.

    RECLIST-RECEIVER = 'test@here.com'.

    RECLIST-EXPRESS = 'X'.

    RECLIST-REC_TYPE = 'U'.

    APPEND RECLIST.

    • copy recipents

    clear RECLIST.

    RECLIST-RECEIVER = 'secondtest@here.com'.

    RECLIST-EXPRESS = 'X'.

    RECLIST-REC_TYPE = 'U'.

    RECLIST-COPY = 'X'.

    APPEND RECLIST.

    • Sending the document

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    DOCUMENT_DATA = DOC_CHNG

    TABLES

    PACKING_LIST = OBJPACK

    OBJECT_HEADER = OBJHEAD

    CONTENTS_BIN = OBJBIN

    CONTENTS_TXT = OBJTXT

    RECEIVERS = RECLIST

    EXCEPTIONS

    TOO_MANY_RECEIVERS = 1

    DOCUMENT_NOT_SENT = 2

    OPERATION_NO_AUTHORIZATION = 4

    OTHERS = 99.

    Thanks & regards

    Sreenivasulu P

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 16, 2010 at 03:45 AM

    Hello All - Good day!

    I have the same problem where non-english text like russian, and will appear garbage in the excel attachment after it was email.

    When I test it in english description/text it looks ok.

    I have tried the following FM, and got no luck.

    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    Program is in Unicode.

    PLEASE help.

    Add comment
    10|10000 characters needed characters exceeded