Varnish
2015-06-07 19:43
435 查看
Sending workflow notification to Requestor in HTML format
By Manica Senapati, Intelligroup from LinkAim: To Send Workflow Notification to Requestor in HTML Format
Step1:
Create Function module for sending workflow notification in HTML format.
FUNCTION zsend_notif_mail_emp. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(TRIPNO) TYPE BAPITRIP-TRIPNO OPTIONAL *" REFERENCE(EMP_EMAIL) TYPE ADR6-SMTP_ADDR OPTIONAL *" REFERENCE(EMP_NAME) TYPE PA0002-CNAME OPTIONAL *" REFERENCE(APPR_FLAG) TYPE SYST-INPUT OPTIONAL
DATA : it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE, it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE, t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, w_doc_data LIKE sodocchgi1.
w_doc_data-sensitivty = 'F'. "Fill the document data and get size of attachment w_doc_data-doc_size = 15 * 255. "Populate the subject/generic message attributes w_doc_data-obj_langu = sy-langu. w_doc_data-obj_name = 'SAPRPT'.
CONCATENATE 'Your Travel Request' tripno 'has been sent for approval' INTO w_doc_data-obj_descr SEPARATED BY space.
CLEAR t_receivers. t_receivers-receiver = emp_email. "Get requestor mail id from table PA0105 based on his PERNR. t_receivers-rec_type = 'U'. t_receivers-com_type = 'INT'. t_receivers-notif_del = 'X'. t_receivers-notif_ndel = 'X'. APPEND t_receivers.
REFRESH it_message. CLEAR it_message. CONCATENATE '<B><FONT COLOR="RED">' '*******THIS IS AN SYSTEM GENERATED NOTIFICATION. PLEASE DO NOT REPLY TO THIS E-MAIL.*******' '</B><BR>' INTO it_message. " SEPARATED BY space. APPEND it_message. CLEAR it_message. it_message = '<BR></FONT>'. APPEND it_message. CLEAR it_message. CONCATENATE 'Dear' emp_name '<BR>' INTO it_message SEPARATED BY space. APPEND it_message. CLEAR it_message. it_message = '<BR>'. APPEND it_message. CLEAR it_message.
IF appr_flag = 'A'. CONCATENATE 'Your travel request' tripno 'has been approved.' '<BR><BR>' INTO it_message SEPARATED BY space. APPEND it_message. CLEAR it_message. ELSEIF appr_flag = 'R'. CONCATENATE 'Your travel request' tripno 'has been denied.' '<BR><BR>' INTO it_message SEPARATED BY space. APPEND it_message. CLEAR it_message. ELSEIF appr_flag = 'S'. CONCATENATE 'Your travel request' tripno 'has been returned to you for corrections.' '<BR><BR>' INTO it_message SEPARATED BY space. APPEND it_message. CLEAR it_message. ENDIF.
it_message = 'If you have any questions regarding this action, please contact your supervisor.'. APPEND it_message. CLEAR it_message.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' EXPORTING document_data = w_doc_data document_type = 'HTM' " To get the notification in HTML format commit_work = 'X' TABLES object_content = it_message receivers = t_receivers.
Import Parameters in function module ZSEND_NOTIF_MAIL_EMP:
Step2:
Method to send Notification.
BEGIN_METHOD ZSENDNOTIFMAILEMP CHANGING CONTAINER. DATA: TRIPNO TYPE BAPITRIP-TRIPNO, EMPEMAIL TYPE ADR6-SMTP_ADDR, EMPNAME TYPE PA0002-CNAME, APPRFLAG TYPE SYST-INPUT.
SWC_GET_ELEMENT CONTAINER 'EmpEmail' EMPEMAIL. SWC_GET_ELEMENT CONTAINER 'EmpName' EMPNAME. SWC_GET_ELEMENT CONTAINER 'ApprFlag' APPRFLAG.
tripno = object-key-tripnumber.
CALL FUNCTION 'ZSEND_NOTIF_MAIL_EMP' EXPORTING TRIPNO = TRIPNO EMP_EMAIL = EMPEMAIL EMP_NAME = EMPNAME APPR_FLAG = APPRFLAG.
END_METHOD.
Step3: Task to call our Method in Workflow.
Step4:
Workflow definition
Step5:
Event Activation (Event Linkage)
Output:
Whenever a trip is created in ESS or in transaction code TRIP, you will get a notification mail in your inbox as shown below.
相关文章推荐
- Android 优化电池使用时间 ——监控电池电量和充电状态
- java动态代理
- android 选择图片 剪裁 拍照 兼容所有版本的代码
- AngularJS简单用法
- IP变种繁殖原理、畸形变异 IP 域名
- Introduction to RTP Proxy (1)
- 15第十四周项目一——小玩文件
- [推荐视频教程]-[Java][传智播客 俄罗斯方法游戏开发 视频教程][avi]
- mac下mysql
- 用一维数组实现栈(C++编程思想 p120)
- (T.T) 打印100到200之间的素数
- 管金生首次公开谈327事件
- HttpClient性能对比
- LeetCode10 Regular Expression Matching
- CentOS 6.x 升级 Git
- JSR: Java Specification Requests
- 第十三周项目三-立体类族共有的抽象类
- shell学习第二天
- python中的参数传递和返回值
- 面试题:谈谈你对hibernate的理解