<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem in sending mails to multiple users Using the Class CL_BCS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011329#M1166410</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two suggestions:&lt;/P&gt;&lt;P&gt;1. what does the exception say? You are catching the error, but retrieve the actual message of this exception to find out what the exact problem is.&lt;/P&gt;&lt;P&gt;2. In stead of doing the send within the loop, do this outside of the loop. Add recipients within the loop and next do the send request. You are creating ONE document and are sending this in the first SEND, but next you want to send it again. Think this should then be a new document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jan 2009 19:34:59 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2009-01-08T19:34:59Z</dc:date>
    <item>
      <title>Problem in sending mails to multiple users Using the Class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011328#M1166409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I am using the class CL_BCS for sending mails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is i am able to send mail to only one email-id.Now i need to send the mail to multiple email-id's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting an exception when i am trying to send the mail to the second email-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below my code and suggest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
TRY.
*--Create persistent send request
    gc_send_request = cl_bcs=&amp;gt;create_persistent( ).

*--create and set document

*----Create document from internal table with text
    APPEND gw_text_mail TO tl_text.
    gc_document = cl_document_bcs=&amp;gt;create_document(
                    i_type    = gc_raw
                    i_text    = tl_text
                    i_length  = gc_len
                    i_subject = 'Testing upload of file' ).

*----Add document to send request
    CALL METHOD gc_send_request-&amp;gt;set_document( gc_document ).

*----Add recipient (e-mail address)
    LOOP AT r_email ASSIGNING &amp;lt;fs_mail&amp;gt;.
      ASSIGN COMPONENT 3 OF STRUCTURE &amp;lt;fs_mail&amp;gt; TO &amp;lt;fs_val&amp;gt;.
      gc_recipient = cl_cam_address_bcs=&amp;gt;create_internet_address(
                                        &amp;lt;fs_val&amp;gt; ).

*----Add recipient with its respective attributes to send request
      CALL METHOD gc_send_request-&amp;gt;add_recipient
        EXPORTING
          i_recipient = gc_recipient
          i_express   = gc_express.

*----Send document
      CALL METHOD gc_send_request-&amp;gt;send(
        EXPORTING
          i_with_error_screen = gc_err_screen
        RECEIVING
          result              = gw_sent_to_all ).
      IF gw_sent_to_all = gc_x.
        COMMIT WORK.
        MESSAGE s002(zfi_e012).
      ENDIF.

    ENDLOOP.

  CATCH cx_bcs INTO gc_bcs_exception.
    IF NOT gc_bcs_exception IS INITIAL.
      EXIT.
    ENDIF.
ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:12 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 17:54:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011328#M1166409</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-08T17:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in sending mails to multiple users Using the Class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011329#M1166410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two suggestions:&lt;/P&gt;&lt;P&gt;1. what does the exception say? You are catching the error, but retrieve the actual message of this exception to find out what the exact problem is.&lt;/P&gt;&lt;P&gt;2. In stead of doing the send within the loop, do this outside of the loop. Add recipients within the loop and next do the send request. You are creating ONE document and are sending this in the first SEND, but next you want to send it again. Think this should then be a new document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 19:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011329#M1166410</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-01-08T19:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in sending mails to multiple users Using the Class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011330#M1166411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Arun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the coding shown below I have no problems to send e-mails to multiple receivers (1st = main, ELSE = Cc):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
...
*     --------- set sender -------------------------------------------
*     note: this is necessary only if you want to set the sender
*           different from actual user (SY-UNAME). Otherwise sender is
*           set automatically with actual user.

      lo_sender = cl_sapuser_bcs=&amp;gt;create( sy-uname ).
      CALL METHOD lo_send_request-&amp;gt;set_sender
        EXPORTING
          i_sender = lo_sender.

*     --------- add recipient (e-mail address) -----------------------
*   create recipients - please replace e-mail address !!!



      CALL FUNCTION 'Z_IDOC_MAINT_GET_MAIL_RCVR'
        IMPORTING
          et_receiver = lt_receiver.
      LOOP AT lt_receiver INTO ld_email.
*       1st receiver = main receiver, ELSE = Cc
        IF ( syst-tabix = 1 ).
          lx_copy = abap_false.
        ELSE.
          lx_copy = abap_true.
        ENDIF.

        lo_recipient = cl_cam_address_bcs=&amp;gt;create_internet_address(
                                          ld_email ).

*        TRY.
        CALL METHOD lo_send_request-&amp;gt;add_recipient
          EXPORTING
            i_recipient = lo_recipient
            i_express   = 'X'
            i_copy      = lx_copy.
      ENDLOOP.
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 19:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011330#M1166411</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2009-01-08T19:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in sending mails to multiple users Using the Class CL_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011331#M1166412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Micky.&lt;/P&gt;&lt;P&gt;Problem resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 20:00:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-sending-mails-to-multiple-users-using-the-class-cl-bcs/m-p/5011331#M1166412</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-08T20:00:46Z</dc:date>
    </item>
  </channel>
</rss>

