‎2010 Apr 28 6:10 PM
Good morning,
I tried to send out an email to internet adress using cl_bsc class but I could not find it through SOST tcode.
Please help! Following is the source code:
report z_test.
DATA: send_request TYPE REF TO cl_bcs.
DATA: li_main_text TYPE bcsy_text,
lw_main_text LIKE LINE OF li_main_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: sender TYPE REF TO if_sender_bcs.
DATA: l_mtitle LIKE sodocchgi1-obj_descr.
DATA: sent_to_all TYPE os_boolean.
DATA: bcs_exception TYPE REF TO cx_bcs.
TRY.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document---------------
* Email title
l_mtitle = 'Testing Email from Khaliachika'.
* Fill the body of the mail
REFRESH li_main_text.
lw_main_text = 'Testing email'.
APPEND lw_main_text TO li_main_text.
CLEAR: lw_main_text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = li_main_text
i_subject = l_mtitle ).
* Add document object to send request
send_request->set_document( document ).
* Sender infor
sender = cl_cam_address_bcs=>create_internet_address(
'email address here' ). "Since SDN does not allow to put email address
send_request->set_sender( sender ).
* --------- add recipient (e-mail address) -----------------------
recipient =
cl_cam_address_bcs=>create_internet_address(
'email address' ).
* Add recipient object to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
* ---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
* IF sent_to_all IS INITIAL.
IF sent_to_all IS INITIAL.
MESSAGE i500(sbcoms) WITH 'email address'.
EXIT.
ENDIF.
COMMIT WORK.
* ------------ exception handling ----------------------------------
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.Thanks,
Khanh
‎2010 Apr 28 6:38 PM
Hi,
Any idea please?
<< Removed >>
Everything was OK and send_to_all = 'X' but I could not see the email in SOST.
By the way, the lastest email I can see in SOST was 3 months ago.
Any suggestion?
Thanks,
Khanh
Edited by: khaliachika on Apr 28, 2010 8:01 PM
Edited by: Rob Burbank on Apr 28, 2010 3:04 PM
‎2010 Apr 28 6:38 PM
Hi,
Any idea please?
<< Removed >>
Everything was OK and send_to_all = 'X' but I could not see the email in SOST.
By the way, the lastest email I can see in SOST was 3 months ago.
Any suggestion?
Thanks,
Khanh
Edited by: khaliachika on Apr 28, 2010 8:01 PM
Edited by: Rob Burbank on Apr 28, 2010 3:04 PM
‎2010 Apr 28 7:58 PM
Is the Recipient Email address maintained in SCOT ?. It needs to be maintained in SCOT.
‎2010 Apr 28 8:14 PM
>
> By the way, the lastest email I can see in SOST was 3 months ago.
That may be the problem. I ran your program and it sent and received an e-mail.
Rob
‎2010 Apr 28 11:31 PM
‎2010 Apr 29 12:09 AM
Hi Phani,
The issue was because of SOST configuration, it was default uncheck the option 'Select waiting send requests in selected time period only' in Options tab.
I rewarded you 2 points already.
I tried Rob's suggestion and found the target.
Thanks for your time,
Khanh
Edited by: khaliachika on Apr 29, 2010 1:12 AM