2015 Jan 27 9:03 AM
Hi All,
I have developed a program in which I am sending two separate emails to multiple ( same ) recipient using
send method of cl_bcs.
But only first mail is going and second email is not going.
Pls help.
Thanks,
Arpita
2015 Jan 27 9:09 AM
Hi,
you can add all the recipients with method add_recipient
loop at lt_recipient into lo_recipient.
try.
call method lo_bcs->add_recipient
exporting
i_recipient = lo_recipient.
catch cx_send_req_bcs . "#EC NO_HANDLER
endtry.
endloop.
Don't forget a commit work after having called the send method.
If this still doesn't work, you should check if the second recipient is valid. Check transaction SOST.
With best regards,
Hubert
2015 Jan 28 4:42 AM
My requirement is not to send to mail to multiple recipients but send multiple emails
from same program.
I am able to send only first email second mail is not going even though I have used two separate instances of class cl_bcs.
Thanks,
Arpita
2015 Jan 27 9:11 AM
2015 Jan 27 9:39 AM
2015 Jan 28 6:58 AM
Hi Arpita,
You need to call all methods from cl_bcs=>create_persistent( ). to send().
and do a COMMIT WORK for each mail.
example:-
DO 2 times.
cl_bcs=>create_persistent( ).
send().
COMMIT WORK
ENDDO.
Thanks,
Sharath
2015 Jan 28 4:58 AM
Hi Apita,
Adjust below code according to your requirement..
Try
......
**** --------- 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.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
**** --------- add recipient (e-mail address) -----------------------
**** create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address(
wa_addsmtp-e_mail ).
***** add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
recipient = cl_cam_address_bcs=>create_internet_address(
'abc@company.com' ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
recipient = cl_cam_address_bcs=>create_internet_address(
'xyz@company.com' ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
**** ---------- send document ---------------------------------------
CALL METHOD send_request->set_send_immediately( 'X' ).
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
WRITE text-003.
ENDIF.
COMMIT WORK.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Error in Sending Mail.'(001).
WRITE: 'Error in Sending Mail:'(002), bcs_exception->error_type.
EXIT.
Endtry.
Thanks
Tharaka
2015 Jan 28 5:28 AM
Hi..
In which format are you sending document?,...and where is email content?
2015 Jan 28 5:49 AM
Hi Apita,
Above was a part of full coding..
Please find the text file for coding...
Thanks
Tharaka
2015 Jan 28 6:14 AM
My problem solved..
I am able to send multiple emails to multiple recipients using HTM type (earlier RAW was used so only one email was going at a time)
and formatted email body using html tags.
thanks,
Arpita
2015 Jan 28 7:18 AM