on 04-27-2005 6:28 AM
Guys I am trying to send mail to my outlook using this program , the program is executing properly but I am not getting any emails. DO I need to configure SAP ?
Thanks
Manish
<i><b>CLASS ca_sapuser_bcs DEFINITION LOAD.
CLASS cl_cam_address_bcs DEFINITION LOAD.
DATA: l_rcl_send_request TYPE REF TO cl_bcs.
DATA: l_rcl_document TYPE REF TO cl_document_bcs.
DATA: l_rcl_sender TYPE REF TO cl_sapuser_bcs.
DATA: l_rif_recipient TYPE REF TO if_recipient_bcs.
DATA: l_rif_copy TYPE REF TO if_recipient_bcs.
DATA: l_rcl_bcs_exception TYPE REF TO cx_bcs.
DATA: l_cnt_num_rows TYPE i.
DATA: l_cnt_textlength TYPE so_obj_len.
DATA: l_tab_content TYPE soli_tab.
DATA: l_sav_sender TYPE sy-uname.
DATA: l_sav_address TYPE adr6-smtp_addr.
DATA: l_sav_subject TYPE so_obj_des.
TRY.
Create persistent send request
l_rcl_send_request = cl_bcs=>create_persistent( ).
data conversion is necessary even if Dataelement is the same
l_tab_content[] = i_tab_content[].
Create document
DESCRIBE TABLE i_tab_content LINES l_cnt_num_rows.
l_cnt_num_rows = l_cnt_num_rows * 255.
MOVE l_cnt_num_rows TO l_cnt_textlength.
Check for Subject
IF i_sav_subject IS INITIAL.
l_sav_subject = 'no subject'.
ELSE.
l_sav_subject = i_sav_subject.
ENDIF.
l_rcl_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_tab_content
i_length = l_cnt_textlength
i_subject = l_sav_subject ). "#EC *
Add document to send request
CALL METHOD l_rcl_send_request->set_document( l_rcl_document ).
Define Sender - check for import-parameter
IF i_sav_sender IS NOT INITIAL.
l_sav_sender = i_sav_sender.
ELSE.
l_sav_sender = sy-uname.
ENDIF.
Get sender object
l_rcl_sender = cl_sapuser_bcs=>create( l_sav_sender ).
Add sender
CALL METHOD l_rcl_send_request->set_sender
EXPORTING
i_sender = l_rcl_sender.
data conversion is necessary even if Dataelement is the same
l_sav_address = i_sav_smtp_receiver.
Create recipient
l_rif_recipient = cl_cam_address_bcs=>create_internet_address(
l_sav_address ).
Add recipient with its respective attributes to send request
CALL METHOD l_rcl_send_request->add_recipient
EXPORTING
i_recipient = l_rif_recipient
i_express = ' '
i_copy = ' '
i_blind_copy = ' '.
Create Copy receiver
IF i_sav_smtp_copy IS NOT INITIAL.
data conversion is necessary even if Dataelement is the same
l_sav_address = i_sav_smtp_copy.
Create recipient
l_rif_copy = cl_cam_address_bcs=>create_internet_address(
l_sav_address ).
Add recipient with its respective attributes to send request
CALL METHOD l_rcl_send_request->add_recipient
EXPORTING
i_recipient = l_rif_copy
i_express = ' '
i_copy = 'X'
i_blind_copy = ' '.
ENDIF.
Send document
CALL METHOD l_rcl_send_request->send( ).
COMMIT WORK.
catch errors and raise bapi exception
CATCH cx_bcs INTO l_rcl_bcs_exception.
call method messages->add_message
exporting
condition = 'E'
message = 'Message Not Sent'.
ENDTRY.</b></i>
Yep you need to do some configuration on your system in fact if you go into Transaction SCOT you might see several items therte waiting or in error.
Check out these weblogs from Thomas:
/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
Message was edited by: Craig Cmehil
Raja was faster
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes some configuration is required.
For details
chek out this weblog from Thomas Jung.
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.