`
evangxli
  • 浏览: 230720 次
  • 性别: 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 解决方案 在使用Oracle 10g的过程中,部分用户可能会遇到一个特定的问题:在登录企业管理器(Enterprise Manager, EM)时,系统会...

    A Guide to Using VBScript in SecureCRT

    根据给定文件的信息,以下是对标题“A Guide to Using VBScript in SecureCRT”及描述内容的知识点整理: VBScript是一种由微软开发的轻量级的脚本语言,它通常用于客户端脚本编程,在IE浏览器中可以执行。而...

    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.

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

    然而,一些用户在尝试一键boot时可能会遇到“sending boot FAILED”这样的错误,导致刷机过程无法正常进行,窗口瞬间关闭。这通常是由于设备与计算机之间的通信问题,或者是bootloader加载失败所引起的。 为了解决...

    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....

    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 ...

    This is a complete email sending client in Visual Basic

    标题中的“这是一款完整的Visual Basic电子邮件发送客户端”表明这是一个使用Visual Basic编程语言开发的应用程序,其功能是允许用户发送电子邮件。在IT领域,这通常涉及到SMTP(Simple Mail Transfer Protocol)...

    计算机网络第六版答案

    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 ...

    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 ...

    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 ...

    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 ...

    Sending the contents of a webpage with images as an HTML mail

    标题"Sending the contents of a webpage with images as an HTML mail"指的是将网页的完整内容,包括图片,作为HTML格式的邮件发送出去。描述进一步强调了这个主题,即处理网页和其图像的邮件发送过程。接下来,...

    Laravel开发-laravel-notification

    在Laravel框架中,`laravel-notification`是一个强大的特性,用于帮助开发者轻松地创建和发送各种类型的通知。这个特性使得应用程序能够以多种渠道通知用户,如电子邮件、短信、推送通知等,大大提升了用户体验和...

    Go in Practice.pdf

    The book "Go in Practice" is an essential resource for developers looking to deepen their understanding and proficiency in the Go programming language. Authored by Matt Butcher and Matt Farina, with a...

    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.

    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, ...

Global site tag (gtag.js) - Google Analytics