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: 

SO_NEW_DOCUMENT_ATT_SEND_API1 keep same receiver

SimoneMilesi
Active Contributor
0 Kudos

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

CodeTextSMTP_ADDR
1TXT1a.b@mail.com
1TXT2a.b@mail.com
2TXT rec2a.b@mail.com
3TXT rec3b.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?

2 REPLIES 2

Clemenss
Active Contributor
0 Kudos

Hi

Support for SO_NEW_DOCUMENT_* Modules has been canceled. Use CL_BCS.

Regards

Clemens

0 Kudos

Yes, for new report i prefer and use CL_BCS.... but i would prefer avoid to rewrite the email building code since i'm a bit lazy when it comes to modify existing code

If i got no more options i'll take this way