Skip to Content
0
Former Member
Sep 13, 2010 at 01:49 PM

SO_NEW_DOCUMENT_SEND_API1 multiple recipients

2573 Views

Hi,

I am using SO_NEW_DOCUMENT_SEND_API1 and it is working fine for me if there is one recipient.

Now I want to send the email to more than one recipient, so I just added the additional recipients into the table LT_MAILRECIPIENTS.

LT_MAILRECIPIENTS-REC_TYPE  = 'U'.
LT_MAILRECIPIENTS-RECEIVER = 'email1address'.
APPEND LT_MAILRECIPIENTS .
LT_MAILRECIPIENTS-RECEIVER = 'email2address'.
APPEND LT_MAILRECIPIENTS .
CLEAR LT_MAILRECIPIENTS.

Now if I call the function, it will only send to the first recipient in the table!

I tried to do a loop at LT_MAILRECIPIENTS and then call the function. Then it will send to all of them, but in the above case, every recipient will receive 2 emails instead of only 1.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = LT_MAILSUBJECT
      TABLES
        OBJECT_CONTENT             = LT_MAILTXT
        RECEIVERS                  = LT_MAILRECIPIENTS
      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 EQ 0.
      COMMIT WORK.

Any suggestions how I can send the email to all recipients in my table?

Thanks

Anne