2011 Aug 08 9:21 AM
Hi expert,
We use a specific program for sending email by using cl_bcs class. But I want to know if it's possible in case of no-distribution mail to send another email a speicific adress by defining a sender?
This is my actual code:
data: send_request type ref to cl_bcs,
send_bad_request type ref to cl_bcs,
document type ref to cl_document_bcs,
recipient type ref to if_recipient_bcs,
bcs_exception type ref to cx_bcs,
sent_to_all type os_boolean,
pdf_content type solix_tab,
send_request = cl_bcs=>create_persistent( ).
-------- create and set document -------------------------------
pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).
document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = pdf_content
i_length = pdf_size
i_subject = 'Notice of payment' ). "#EC NOTEXT
add document object to send request
send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address(
mail_vendor ).
add recipient object to send request
send_request->add_recipient( recipient ).
send_request->set_send_immediately( 'X' ).
---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
send_bad_request = cl_bcs=>create_persistent( ).
-------- create and set document -------------------------------
document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = pdf_content
i_length = pdf_size
i_subject = 'Notice of no-distribution' ). "#EC NOTEXT
add document object to send request
send_bad_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address(
p_mail ).
add recipient object to send request
send_bad_request->add_recipient( recipient ).
---------- send document ---------------------------------------
sent_to_all = send_bad_request->send( i_with_error_screen = 'X' ).
endif.
commit work.
Thanks and regards.
Hi expert,
We use a specific program for sending email by using cl_bcs class. But I want to know if it's possible in case of no-distribution mail to send another email a speicific adress by defining a sender?
This is my actual code:
data: send_request type ref to cl_bcs,
send_bad_request type ref to cl_bcs,
document type ref to cl_document_bcs,
recipient type ref to if_recipient_bcs,
bcs_exception type ref to cx_bcs,
sent_to_all type os_boolean,
pdf_content type solix_tab,
send_request = cl_bcs=>create_persistent( ).
-------- create and set document -------------------------------
pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).
document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = pdf_content
i_length = pdf_size
i_subject = 'Notice of payment' ). "#EC NOTEXT
add document object to send request
send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address(
mail_vendor ).
add recipient object to send request
send_request->add_recipient( recipient ).
send_request->set_send_immediately( 'X' ).
---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
send_bad_request = cl_bcs=>create_persistent( ).
-------- create and set document -------------------------------
document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = pdf_content
i_length = pdf_size
i_subject = 'Notice of no-distribution' ). "#EC NOTEXT
add document object to send request
send_bad_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address(
p_mail ).
add recipient object to send request
send_bad_request->add_recipient( recipient ).
---------- send document ---------------------------------------
sent_to_all = send_bad_request->send( i_with_error_screen = 'X' ).
endif.
commit work.
Thanks and regards.
2011 Aug 08 9:46 AM
if you want to define a different sender to a particulat case you can do it.
we have prev used a method to change the SENDER.
have you checked the class CL_BCS?
cl_bcs=>sender method
2011 Aug 08 9:50 AM
2011 Aug 08 9:56 AM
you also can use this method
cl_cam_address_bcs=>create_internet_address
for defining the address
2011 Aug 08 10:22 AM
Hi,
Thanks for your reply.
But my problem in case of no-distribution of the email, I want to send another mail to declare "the mail was not send because the mail adress does not exist."
If i declare the sender does he received the mail in case of no-distribution?
Thanks and regards
2011 Aug 08 10:27 AM
OK,
I have understanding with a mail from my administrator.
If i define the sender this one will receive the notice of no-distribution.
I will test it if it's work i close this thread.
Thanks for your help
2011 Aug 08 10:29 AM
the above methods will only be used to set the sender's(FROM) address.
it wont trigger another email.
you need to whether the you have send the document successfully or not...then u can trigger another email
Edited by: ssm on Aug 8, 2011 3:00 PM
2011 Aug 08 10:37 AM
Yes I have understanding this point ^^
But the think is when the SMTP server will sending the email in case of no-distribution this one will sent a mail to the sender (I hope) so I will declare the sender and in case of no distribution the SMTP server will sent the message automatically to the sender.
I will test this way and give you a feedback when it's OK
2011 Aug 09 10:29 AM
Hi,
Please try with : cl_cam_address_bcs=>create_internet_address
Like this,
gv_sc_address = 'SAP*@COMPANY.COM'.
TRY.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = gv_sc_address
i_address_name = gv_sc_name
RECEIVING
result = gv_address.
CATCH cx_address_bcs.
ENDTRY.