Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- METHOD if_swf_ifs_workitem_exit~event_raised.
- DATA:
- value_get TYPE char10,
- lv_user TYPE sww_aagent,
- lv_email TYPE string,
- lo_document TYPE REF TO cl_document_bcs,
- sender TYPE REF TO cl_sapuser_bcs,
- lv_body TYPE string,
- text TYPE bcsy_text,
- send_request TYPE REF TO cl_bcs,
- recipient TYPE REF TO if_recipient_bcs,
- sent_to_all TYPE os_boolean.
- DATA(lv_wi_id) = im_workitem_context->get_workitem_id( ).
- DATA(lv_heaad) = im_workitem_context->get_header( ).
- IF im_event_name EQ swrco_event_after_creation.
- CLEAR value_get.
- CALL METHOD get_elem(
- EXPORTING
- im_workitem_context = im_workitem_context
- element_name = 'prm1'
- IMPORTING
- element_value = value_get
- ).
- CLEAR value_get.
- CALL METHOD get_elem(
- EXPORTING
- im_workitem_context = im_workitem_context
- element_name = 'prm2'
- IMPORTING
- element_value = value_get
- ).
- CLEAR value_get.
- CALL METHOD get_elem(
- EXPORTING
- im_workitem_context = im_workitem_context
- element_name = 'users'
- IMPORTING
- element_value = lv_user
- ).
- IF lv_user IS NOT INITIAL.
- CALL FUNCTION 'EFG_GEN_GET_USER_EMAIL'
- EXPORTING
- i_uname = lv_user
- IMPORTING
- e_email_address = lv_email
- EXCEPTIONS
- not_qualified = 1
- user_not_found = 2
- address_not_found = 3
- OTHERS = 4.
- IF sy-subrc <> 0.
- lv_email = 'admin@admin.fr'.
- ENDIF.
- lv_body = 'mail from wi id #wi_id#'.
- SHIFT lv_wi_id LEFT DELETING LEADING '0'.
- REPLACE ALL OCCURRENCES OF '#wi_id#' IN lv_body WITH lv_wi_id.
- APPEND lv_body TO text.
- send_request = cl_bcs=>create_persistent( ).
- lo_document = cl_document_bcs=>create_document(
- i_type = 'HTM'
- i_text = text
- i_subject = 'mail from program exit' ).
- CALL METHOD send_request->set_document( lo_document ).
- sender = cl_sapuser_bcs=>create( 'WF-BATCH' ).
- CALL METHOD send_request->set_sender
- EXPORTING
- i_sender = sender.
- DATA lv_mail TYPE adr6-smtp_addr.
- lv_mail = lv_email.
- recipient = cl_cam_address_bcs=>create_internet_address(
- lv_mail ).
- CALL METHOD send_request->add_recipient
- EXPORTING
- i_recipient = recipient
- i_express = 'X'.
- CALL METHOD send_request->send(
- EXPORTING
- i_with_error_screen = 'X'
- RECEIVING
- result = sent_to_all ).
- IF sent_to_all = 'X'.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement