`
evangxli
  • 浏览: 223642 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

转 Sending workflow notification to Requestor in HTML format

 
阅读更多

Sending workflow notification to Requestor in HTML format

By Manica Senapati, Intelligroup from Link

 

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.

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.

分享到:
评论

相关推荐

    oracle_10g提示java.lang.Exception_Exception_in_sending_Request__null解决方案

    oracle_10g提示java.lang.Exception_Exception_in_sending_Request__null解决方案

    This is a complete email sending client in Visual Basic

    This is a complete email sending client in Visual Basic

    MIT@001-WorkFlow Management

    Of course, the database will have to be updated in order to reflect the new status of this person. This is done after sending the letters, by the same person from recruitment who sent the letter.

    shutdown agent

    简单常用的关机助手。。。。

    解决VS2012 Express的There was a problem sending the command to the program问题

    安装Visual Studio 2012 Express之后,双击打开web.config文件时经常出现“There was a problem sending the command to the program”的错误,然后VS2012 Express打开了,但web.config文件没打开,需要再次双击web....

    计算机网络第六版答案

    27. Creation of a botnet requires an attacker to find vulnerability in some application or system (e.g. exploiting the buffer overflow vulnerability that might exist in an application). After finding ...

    sending_file.rtf.zip_This Just In..

    IT is a small program which illustrate the concept of sending the file to a remote destination.The concept given in this program is purely for the beginners who just needs to understand the concept ...

    Sending Compressed HTTP Reponse in ASP.NET Web Application

    Sending Compressed HTTP Reponse in ASP.NET Web Application

    servlet2.4doc

    Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. -------------------------------------------------------------------------------- G ...

    端口查看工具

    which allows you to set the format of the log line and put in it any column value you like. * Version 1.76: o Added 'One-Click Tray Icon' option. When it's checked and you use the tray icon ...

    Sending Email using MAPI - A COM DLL(sending email demo and soucecode)

    It can be used to send emails automatically with customized user messages and attachments to specific people at particular time, especially while using some exe servers or NT services. That's it. ...

    This example is a very simple solution to sending and receiv

    This example is a very simple solution to sending and receiving data to and from a Parallax Basic Stamp. This example requires a Basic Stamp and the MSComm control. Also included is an example Basic ...

    Introduction to 64Bit Windows Assembly

    The Toy Box allows the use to enter variable definitions and expressions in either C++ or Fortran and it builds a program to evaluate the expressions. Then the user can inspect the format of each ...

    How To Code In HTML5 And CSS3.pdf

    it's for shopping, sending messages, playing games, checking the news or looking at pictures of your friends. With the help of websites, you can have fun, make a living, and even get to know other ...

    Greenshot - a free screenshot tool optimized for productivity

    Want to create or send a screenshot? Get Greenshot!... Some of the options that can be configured in the preferences include output path, image format (JPG, GIF, PNG, BMP) and filename pattern.

    分享在一键boot时出现sending boot FAILED的解决方案

    相信不少筒子在刷机解决wife和蓝牙错误时都是这样一键root或者是adb,但是有时却会出现sending boot FAILED,窗口秒退的情况,本人浏览各大论坛提问的不少,回答的却都没有能解决问题,自己一番摸索后得到找到一个很...

    Sakemail

    The side effect for this is that YOUR app must check if the host is a host name or a IP address, in my app I remove the periods and try to convert the result to a float (long integers don‘t work, ...

    让用户转移到另一个应用程序-Sending the User to Another App

    Android最重要的特性之一就是:一个应用可以基于不同的 action,把用户推送到其他应用中去。比如说,如果你想在你的应用中显示一张带有商店地址的地图,你并不需要在自己的应用中去实现一个显示地图的Activity,而是...

    TICQClient Version

    )[+] Added new items to languages constant array[-] Example wasn‘t showing messages received in RTF format02-July-2002, Version 0.5[+] Added visible/invisible list support: look at AddContactVisible,...

    Camel in action(camel实战)

    Camel in Action is a Camel tutorial full of small examples showing how to work with the integration patterns. It starts with core concepts like sending, receiving, routing, and transforming data. It ...

Global site tag (gtag.js) - Google Analytics