| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
Sending workflow notification to Requestor in HTML formatBy Manica Senapati, Intelligroup Aim:
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.
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||