DATA: BEGIN OF LS_EMAIL,
TYPE TYPE ZE_TYPE01, "角色类型
SUBJECT TYPE STRING, "主题
SENDER TYPE STRING, "发送方(固定值:HRXC)
TO TYPE TABLE OF P0105-USRID_LONG, "sysid, "接收人邮箱
CC TYPE TABLE OF P0105-USRID_LONG, "sysid, "抄送人邮箱
TEMPLATETYPE TYPE STRING, "发送模式(固定值)
CONTENT TYPE STRING, "邮件正文(可带格式,变量:templateparam内)
* templateparam TYPE string, "设置变量值
* attzchments TYPE string, "附件(格式:"FILENAME":"文件BASE64编码")
END OF LS_EMAIL.
APPEND ls_hrp9106-usrid_long TO ls_email-to.
ls_email-subject = '【提醒】' .
邮件格式
CONCATENATE '<table><tr><td>您好,'LV_CHAR'生效的离职申请已审批完成,请知悉。</td></tr>'
'<tr><td> 服务部</td></tr>'
'</table>' INTO LS_EMAIL-CONTENT.
表格发邮件
CONCATENATE '<table><tr><td>尊敬的 'ls_hrp9106-nachn '</td></tr>'
'<tr><td> 您好</td></tr>'
'<tr><td> xxxx具体情况见下列表格。 </td></tr></table>' INTO lv_content.
lv_content2 = '<table border="1" cellspacing="0" text-align: left'.
CONCATENATE lv_content2
'<thead><tr>'
'<th align="left">序号</th>'
'<th align="left">组织单位</th>'
'<th align="left">编制类型</th>'
'</tr></thead>'
INTO lv_content2.
LOOP AT gt_detail INTO gs_detail WHERE antaid = ls_hrp9106-antaid.
lv_index = lv_index + 1.
lv_zjhbz = gs_detail-zjhbz.
lv_zzbrs = gs_detail-zzbrs.
CONCATENATE lv_content2
'<tbody><tr>'
'<td>' lv_index '</td>'
'<td>' gs_detail-orgeh_t '</td>'"组织单位
'<td>' gs_detail-xxxx_t '</td>'"编制类型
'</tr></thead>'
INTO lv_content2.
CLEAR: gs_detail,lv_zjhbz,lv_zzbrs.
ENDLOOP.
CONCATENATE lv_content2 '</table>' '<table><tr><td> 请注意核查 </td></tr><tr><td> 谢谢 </td></tr></table>'INTO lv_content2.
PERFORM frm_send_email USING ls_email CHANGING es_message .
ps_email-sender = 'XXX'.
ps_email-templatetype = 'STRING'.
CALL FUNCTION 'ZFM_DTDHR_ABAP_TO_JSON'
EXPORTING
iv_data = ps_email
IMPORTING
ev_json = lv_contetnt.
REPLACE ALL OCCURRENCES OF 'SUBJECT' IN lv_contetnt WITH 'subject' IGNORING CASE.
REPLACE ALL OCCURRENCES OF 'SENDER' IN lv_contetnt WITH 'sender' IGNORING CASE.
REPLACE ALL OCCURRENCES OF 'TO' IN lv_contetnt WITH 'to' IGNORING CASE.
REPLACE ALL OCCURRENCES OF 'CC' IN lv_contetnt WITH 'cc' IGNORING CASE.
REPLACE ALL OCCURRENCES OF 'TEMPLATETYPE' IN lv_contetnt WITH 'templateType' IGNORING CASE.
REPLACE ALL OCCURRENCES OF 'CONTENT' IN lv_contetnt WITH 'content' IGNORING CASE.
CALL FUNCTION 'ZFM_CALL_URL'
EXPORTING
iv_content = lv_contetnt
iv_request_type = 'POST'
iv_interface_id = 'xxx'
IMPORTING
es_message = ps_message.