Application Development and Automation 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: 
Read only

SO_DOCUMENT_SEND_API1 - Error

Former Member
0 Likes
1,111

Hey everyone,

i am using SO_DOCUMENT_SEND_API1 in a loop. I just want to send text, i dont need an attachment.

The first email is sent fine.

But the second email it sends, contains the body of the first email and an attachement with the body of the first and second email..

So forexample..

Email 1 = ' First Email ' ---> sent on first pass in the loop.

Email 2 = ' Second Email ' ---> sent in the second pass of the loop.

I receive these two emails in my inbox:

Email 1: First Email

Email 2: First Email + txt attachment : First Email. Second Email

I ahve also tried SO_NEW_DOCUMENT_ATT_SEND_API1. and i get the same thing.

Thanks..

-


HERE IS MY CODE ( inside the loop 😞 -


      • Variable full_body changes. e.g. "First Email" on first pass, "Second Email" on second Pass

  • Creating the document to be sent

DOC_CHNG-OBJ_NAME = 'Reservation'.

DOC_CHNG-OBJ_DESCR = 'Reservation About to Expire'.

OBJTXT = full_body.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

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

  • Creating 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.

  • Entering names in the distribution list

RECLIST-RECEIVER = receiver_email.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

  • Sending the document

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

  • PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

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

Edited by: imatari on Sep 22, 2009 7:56 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
985

It looks like in each LOOP you APPEND OBJTXT, but you never REFRESH it.

Rob

4 REPLIES 4
Read only

Former Member
0 Likes
986

It looks like in each LOOP you APPEND OBJTXT, but you never REFRESH it.

Rob

Read only

Former Member
0 Likes
985

Just before the endloop use


REFRESH OBJTXT.
CLEAR OBJTXT.

Read only

Former Member
0 Likes
985

Wow, thanks alot Rob..

i added ( at the end of the loop 😞

refresh objtxt.

refresh objpack.

refresh reclist.

-- with just REFRESH OBJTXT, there is still an attachment is still created on the second email.

i had tried CLEAR OBJTXT before. but that did not work.

But REFRESH works perfect :)..

This really helped, i spent so much time on this..

God Bless Ya.

Read only

Former Member
0 Likes
985

Thanks Everyone..

I appreciate it.