Академический Документы
Профессиональный Документы
Культура Документы
report zsend_notif_fte_probation.
nodes : pernr.
infotypes : 0001,0002,0019.
get pernr.
* select single * from zhr_probation into ls_prob_chk where pernr = p0019 and begda = sy-datum.
* if sy-subrc <> 0.
rp_provide_from_last p0019 space pn-begda pn-endda.
rp_provide_from_last p0001 space pn-begda pn-endda.
if p0019-subty = '13' .
move-corresponding p0019 to ls_p0019.
append ls_p0019 to lt_p0019.
move-corresponding p0001 to ls_p0001.
append ls_p0001 to lt_p0001.
* elseif p0019-subty = '50' .
* move-corresponding p0019 to ls_p0019.
* append ls_p0019 to lt_p0019.
* move-corresponding p0001 to ls_p0001.
* append ls_p0001 to lt_p0001.
endif.
clear: ls_p0019,ls_p0001.
* endif.
end-of-selection.
clear : it_fteh , it_fte , wa_fteh , wa_fte , it_pa0000 , wa_pa0000.
select * from zthr_fte_prob into table it_fteh.
select * from zhr_fte_prob_frm into table it_fte.
ls_cont-element = 'URL'.
ls_cont-value = lv_url.
append ls_cont to lt_cont.
clear ls_cont.
lv_okey = wa_hr_prob_frm-pernr.
ls_cont-element = 'PersonnelNumber'.
ls_cont-value = wa_hr_prob_frm-pernr.
append ls_cont to lt_cont.
clear ls_cont.
clear t_message_body.
w_msg = '<HTML>'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '<HEAD>'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;'.
append w_msg to t_message_body.
clear w_msg.
w_msg = 'CHARSET=ISO-8859-1">'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '</HEAD>'.
append w_msg to t_message_body .
clear w_msg.
w_msg = '<BODY><FONT FACE="CALIBRI">'.
append w_msg to t_message_body .
clear w_msg.
w_msg = '<BR><BR><BR><BR>'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '* THIS IS SYSTEM GENERATED EMAIL, PLEASE DO NOT REPLY TO THIS EMAIL.'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '</FONT></BODY>'.
append w_msg to t_message_body.
clear w_msg.
w_msg = '</HTML>'.
append w_msg to t_message_body.
clear w_msg.
concatenate 'FTE Form for Employee' wa_hr_prob_frm-pernr into w_subj separated by space
* Email Body
wo_document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = t_message_body
i_subject = w_subj ).
" Pass the document to send request
call method wo_send_request->set_document( wo_document ).
"---------------------------- FROM Mail --------------------------------
* Create Sender
wo_sender = cl_cam_address_bcs=>create_internet_address( 'sap@gspcrop.in' ).
* Add sender to send request
clear : wa_fte_prb.
select single * from zthr_fte_prob into wa_fte_prb
where pernr = wa_hr_prob_frm-pernr and man2_pernr ne ' ' .
if sy-subrc = 0.
clear : lv_mail2.
select single usrid_long into lv_mail2
from pa0105 where pernr = wa_fte_prb-man2_pernr and subty = '0010'.
if lv_mail2 is not initial .
clear : w_recpt_1.
w_recpt_1 = lv_mail2.
wo_recipient = cl_cam_address_bcs=>create_internet_address( w_recpt_1 ).
call method wo_send_request->add_recipient
exporting
i_recipient = wo_recipient
i_express = 'X'.
endif.
endif.
if lv_mail1 is not initial or lv_mail2 is not initial .
* Set send immediately
wo_send_request->set_send_immediately( 'X' ).
* Send email.
wo_send_request->send( exporting i_with_error_screen = 'X'
receiving result = w_sent_to_all ).
if sy-subrc eq space and w_sent_to_all eq 'X'.
message 'Mail sent successfully.' type 'S'.
commit work.
submit rsconn01 with mode = 'INT' and return.
wait up to 1 seconds.
endif.
endif.
concatenate 'Workflow triggered for employee no :' wa_hr_prob_frm-pernr into lv_message
write : / lv_message.
if lv_mail1 is initial .
write : / 'Manager1 Intimation Mail id Not Maintained'.
endif.
if lv_mail2 is initial .
write : / 'Manager2 Intimation Mail id Not Maintained'.
endif.
else.
concatenate 'Workflow not triggered for employee no :' wa_hr_prob_frm-pernr into lv_mes
write : / lv_message.
endif.
endif.
clear : lt_message , lt_cont , lv_return , lv_okey.
endloop.
else.
message 'Data Not Found' type 'E'.
endif.
endif.