0

Currently, this is my code which sends on email to one user only even if there are multiple users selected. I want to modify it so one email should be received by multiple users.

"This is for setting the recipient
        lo_sender = cl_sapuser_bcs=>create( s_inbox-low ).

        lo_send_request->add_recipient( lo_sender ).

"This is for sending email with attachment
        l_cl_sent_to_all = lo_send_request->send(
                            i_with_error_screen = 'X' ).

I want to send one email to multiple users. However, In the field Inbox, the program is only selecting the first user in this range.

In this case, only the intern is receiving the email. Is it possible for all the users to receive the email using this code?
lo_sender = cl_sapuser_bcs=>create( s_inbox-low )?

Quite not sure how to use this and was receiving an error code that the recipients are unknown

*         LOOP AT recipients.
*           lo_send_request->add_recipient( s_inbox ).
*         ENDLOOP.

enter image description here

enter image description here

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Bigflatfoot
  • 45
  • 2
  • 13
  • 2
    You need to share more lines from your program. The error not clear with given peace of code. Maybe your recipients variables not declared anywhere. – mkysoft Aug 12 '22 at 07:44
  • 1
    With `s_inbox-low` you only get the "first" element of `s_inbox`. You also need to include `s_inbox-high` and all entries in-between (maybe this https://answers.sap.com/questions/3775987/how-to-loop-on-select-options.html helps). That is also why you are getting the `is not type-compatible...` error. – schmelto Aug 12 '22 at 11:20

1 Answers1

1

This has been resolved by putting the recipients into a LOOP. s_inbox is where the structure of the recipient is stored.

  LOOP AT s_inbox[] ASSIGNING FIELD-SYMBOL(<s_inbox>).
   lo_sender = cl_sapuser_bcs=>create( <s_inbox>-low ).
   lo_send_request->add_recipient( lo_sender ).
  ENDLOOP.
Bigflatfoot
  • 45
  • 2
  • 13