Skip to Content
0
Oct 09, 2014 at 04:09 PM

SO_NEW_DOCUMENT_ATT_SEND_API1 keep same receiver

25 Views

Hi gurus!

i got a strange behavior with the function SO_NEW_DOCUMENT_ATT_SEND_API1.


This a snippet of the logic i've to maintin and check/fix


RECLIST-REC_TYPE = 'U' .
*-- fill the mail adresses
LOOP AT TB_DATA WHERE SMTP_ADDR IS NOT INITIAL.

AT NEW CODE.
REFRESH RECLIST.

REFRESH: OBJTXT ,
OBJPACK .

CLEAR LK_SUBJECT .
* Create message body title and description
*


ENDAT.

IF TB_DATA-SMTP_ADDR CS ';' .
DO.

SPLIT TB_DATA-SMTP_ADDR AT ';' INTO RECLIST-RECEIVER
TB_DATA-SMTP_ADDR .

APPEND RECLIST .

IF TB_DATA-SMTP_ADDR IS INITIAL .
EXIT.
ENDIF.
ENDDO.

ELSE.

MOVE TB_DATA-SMTP_ADDR TO RECLIST-RECEIVER .
APPEND RECLIST .

ENDIF.




AT END OF CODE .

SORT RECLIST.
DELETE ADJACENT DUPLICATES FROM RECLIST .

*-- FM to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.


IF SY-SUBRC <> 0.

ENDIF.


COMMIT WORK.

ENDAT.


ENDLOOP.

Now

i got a table with

Code Text SMTP_ADDR 1 TXT1 a.b@mail.com 1 TXT2 a.b@mail.com 2 TXT rec2 a.b@mail.com 3 TXT rec3 b.d@mail.com

In DEBUG i see that:

1 mail is sent for code = 1 with receiver table filled with 1 record containing a.b@mail.com

1 mail is sent for code = 2 with receiver table filled with 1 record containing a.b@mail.com

1 mail is sent for code =3 with receiver table filled with 1 record containing b.d@mail.com

When i go to SOST transaction ALL the record got a.b@mail.com as receiver!

What i'm missing?