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: 

Problem : Send email

Former Member
0 Kudos

Hi,

I have this code found on the forum.

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).

move 'xx@xx.com' to RECLIST-receiver.

move 'U' to RECLIST-rec_type.

append RECLIST.

DOC_CHNG-OBj_name = 'SENDFILE'.

DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.

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 ).

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.

objbin = '\O/'.

append objbin.

objbin = '/\'.

append objbin.

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.

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.

I receive the email. But when i open the file, all data are in the line.

Thanks for your help.

3 REPLIES 3

sridharreddy_kondam
Active Contributor
0 Kudos

Hi charles ,

Try the code from this link...

(code given by Abdul Hakim)

http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html

Regards,

Sridhar

0 Kudos

It looks almost identical to code I have in place (and working).

OBJPACK-DOC_TYPE = 'TXT'.

I do not think TXT is a valid object type. I do not see it in table TSOTD.

Try using 'RAW' or 'BIN'.

Former Member
0 Kudos

thanks for your help.

i addes this to each line :

CONSTANTS: CON_CRET TYPE X VALUE '0D'.

and now it's ok.