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 need more than one receiver

Former Member
0 Likes
1,067

Hello,

i'll use following FM: SO_DOCUMENT_SEND_API1 for sending email with attachment.

How can i send to more than one receiver?

Thanks for your replies.

1 ACCEPTED SOLUTION
Read only

former_member187255
Active Contributor
0 Likes
749

Christian,

You can append multiple receivers to Receivers itab.

* Add the recipients email address
  CLEAR t_receivers.
  REFRESH t_receivers.
  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.

  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.

  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.


  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            document_data              = w_doc_data
            put_in_outbox              = 'X'
            sender_address             = ld_sender_address
            sender_address_type        = ld_sender_address_type
            commit_work                = 'X'
       IMPORTING
            sent_to_all                = w_sent_all
       TABLES
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers
       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.

Hope this helps you...

Chandra.

3 REPLIES 3
Read only

former_member187255
Active Contributor
0 Likes
750

Christian,

You can append multiple receivers to Receivers itab.

* Add the recipients email address
  CLEAR t_receivers.
  REFRESH t_receivers.
  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.

  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.

  t_receivers-receiver = [email protected].
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.


  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            document_data              = w_doc_data
            put_in_outbox              = 'X'
            sender_address             = ld_sender_address
            sender_address_type        = ld_sender_address_type
            commit_work                = 'X'
       IMPORTING
            sent_to_all                = w_sent_all
       TABLES
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers
       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.

Hope this helps you...

Chandra.

Read only

Former Member
0 Likes
749

You can also set up distribution lists in SBWP (Workplace) which contain multiple email addresses, and send to the list ID instead - that way the users can maintain the email addresses in the list themselves e.g. for a Shared Distribution list you might add:


* Send email to distribution list Z_PRD_SUPPORT Production Support
  ls_rec-receiver = 'Z_PRD_SUPPORT'.
  ls_rec-rec_type = 'C'.
  append ls_rec to lt_rec.

Jonathan

Read only

Former Member
0 Likes
749

I try it on monday. Thanks so long.