In sap abap, clients are want to receive some update or status in through.
""""" Class Declarations
DATA: go_send_request TYPE REF TO cl_bcs,
go_document TYPE REF TO cl_document_bcs,
lo_recipient TYPE REF TO if_recipient_bcs,
lo_bcs_exception TYPE REF TO cx_bcs.
""""" Variables Declarations
DATA: lv_sent_to_all TYPE os_boolean,
lv_email TYPE ad_smtpadr,
gv_subject TYPE so_obj_des,
wa_main_text TYPE soli,
gi_main_text TYPE soli_tab.
wa_main_text = 'HII SIR/MADUM,'.
APPEND wa_main_text TO gi_main_text.
CLEAR wa_main_text.
wa_main_text = 'MY NAME IS RANJAN.'.
APPEND wa_main_text TO gi_main_text. ""body
lv_email = 'ranjanpandarpr@gmail.com'. "email
gv_subject = 'E-MAIL PDF ATTACHMENT.'. "subject
TRY.
go_send_request = cl_bcs=>create_persistent( ).
go_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = gi_main_text ""body
i_subject = gv_subject ). ""subject
""""""" Add document object to send request
go_send_request->set_document( go_document ).
"""""" create recipient object and Add recipient (e-mail address)
lo_recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
"""""" Add recipient object to send request
go_send_request->add_recipient( lo_recipient ).
"""""" Send document
lv_sent_to_all = go_send_request->send( i_with_error_screen = abap_true ).
COMMIT WORK.
IF lv_sent_to_all IS INITIAL.
MESSAGE 'NOT SUCCESSFUL' TYPE 'E'.
ELSE.
MESSAGE 'SUCCESSFUL' TYPE 'S'.
ENDIF.
""""""" Exception handling
CATCH CX_BCS INTO LO_BCS_EXCEPTION.
ENDTRY.
0 Comments