Skip to Content
Author's profile photo Former Member

Mail Notification for PMS Status Change- Workflow

This document explain how to create workflow, event and business object required for custom mail notification for any event change/status change in performance management cycle.



1.     Create Business Object:

T Code: SWO1


Create Custom business object with super type APPR_DOC BO.

/wp-content/uploads/2015/12/image001_858974.png

Provide details for Object. You may use your naming convention as per format.

/wp-content/uploads/2015/12/image002_858975.png

Delegate ZAPPR_DOC object to BO APPR_DOC. It will include all your custom events, methods in standard supertype APPR_DOC.

/wp-content/uploads/2015/12/image003_858976.png

Provide Object type as standard BO APPR_DOC and in delegation type as ZAPPR_DOC.

/wp-content/uploads/2015/12/image004_858977.png

Create custom event by placing cursor on events and click on Create icon.

/wp-content/uploads/2015/12/image005_858978.jpg

Provide Event name as per your naming convention.

/wp-content/uploads/2015/12/image006_858979.png

Implement custom events and Object Component.

/wp-content/uploads/2015/12/image007_858980.jpg

/wp-content/uploads/2015/12/image008_858981.jpg

Generate created BO ZAPPR_DOC.

/wp-content/uploads/2015/12/image009_858982.png

Step 2: Create Task for fetching details for mail content and email id of receiver. Design single task for all workflows for PMS mail. Hence, get all the details required for mail in single task.

T Code: PFTC

/wp-content/uploads/2015/12/image010_858983.png

Provide basic details as shown.

/wp-content/uploads/2015/12/image011_858984.png

On 3rd tab container, create container elements where details to be stored in container.

/wp-content/uploads/2015/12/image012_858985.jpg

Create elements.

/wp-content/uploads/2015/12/image013_858986.jpg

While saving task, it will give error as we have defined method GetDetails from BO but there is not such method exist.

So in other session open, BO and create Method GetDetails.

/wp-content/uploads/2015/12/image014_858987.jpg

Create Report. Do not create function module.

/wp-content/uploads/2015/12/image015_858988.png

In Program, write logic to get details and set details in elements.

/wp-content/uploads/2015/12/image016_858989.png

Source Code:

DATA E_ID TYPE P0105USRID_LONG,
M_ID
TYPE P0105USRID_LONG,
E_NACHN
TYPE P0002NACHN,
E_VORNA
TYPE P0002VORNA,
M_NACHN
TYPE P0002NACHN,
M_VORNA
TYPE P0002VORNA,
APPRAISAL_ID
TYPE HAP_S_APPRAISAL_ID,
APPR_ID
TYPE HAP_S_APPRAISAL_IDAPPRAISAL_ID,
LS_E0002 
TYPE PA0002,
LS_M0002
TYPE PA0002.

DATA: LV_EPERNR TYPE PERNRPERNR,
LV_MPERNR
TYPE PERNRPERNR.

DATA : LT_APPRAISEE TYPE HAP_T_HEADER_APPRAISEE,
LS_APPRAISEE
TYPE HAP_S_HEADER_APPRAISEE,
LT_APPRAISER
TYPE HAP_T_HEADER_APPRAISER,
LS_APPRAISER
TYPE HAP_S_HEADER_APPRAISER.

SWC_GET_ELEMENT CONTAINER ‘Emp_ID’ E_ID.
SWC_GET_ELEMENT CONTAINER
‘Man_ID’ M_ID.
SWC_GET_ELEMENT CONTAINER
‘E_NACHN’ E_NACHN.
SWC_GET_ELEMENT CONTAINER
‘E_VORNA’ E_VORNA.
SWC_GET_ELEMENT CONTAINER
‘M_NACHN’ M_NACHN.
SWC_GET_ELEMENT CONTAINER
‘M_VORNA’ M_VORNA.
SWC_GET_ELEMENT CONTAINER
‘APPR_ID’ APPR_ID.

*APPRAISAL_ID-APPRAISAL_ID = ‘0A0C7CCDFD141EE5A98419E67ED2C123’.
APPRAISAL_ID
APPRAISAL_ID = APPR_ID.

CLEAR : LS_APPRAISEE, LS_APPRAISER.
REFRESH : LT_APPRAISEE, LT_APPRAISER.
CALL FUNCTION ‘HRHAP_DOCUMENT_GET_DETAIL’
EXPORTING
*   ADD_ON_APPLICATION =
*   MODE               = ‘ ‘
*   UI_MODE            = ‘ ‘
PLAN_VERSION      
= ’01’
S_APPRAISAL_ID    
= APPRAISAL_ID
*   ADMINISTRATOR      = ‘ ‘
*   S_DISPLAY_UI       =
*   NO_ACTION_LOG      = ‘ ‘
*   IGNORE_COLUMN_NUMBER          =
IMPORTING
*   S_DOC_PROCESSING   =
*   S_HEADER_TEXTS     =
T_HEADER_APPRAISER
= LT_APPRAISER
T_HEADER_APPRAISEE
= LT_APPRAISEE
*   T_HEADER_PART_APPRAISER       =
*   T_HEADER_OTHERS    =
*   S_HEADER_STATUS    =
*   S_HEADER_DATES     =
*   T_HEADER_ADD_DATA  =
*   S_HEADER_DISPLAY   =
*   T_BUTTONS          =
*   T_BODY_COLUMNS     =
*   T_BODY_ELEMENTS    =
*   T_BODY_ELEMENT_BUTTONS        =
*   T_BODY_ELEMENT_DESCR          =
*   T_BODY_CELLS       =
*   T_BODY_CELL_VAL_VALUES        =
*   T_BODY_CELL_VAL_RANGES        =
*   T_BODY_CELL_VAL_C_LIKE        =
*   T_BODY_CELL_VAL_DESCR         =
*   T_BODY_CELL_NOTES  =
*   T_STATUS_NOTES     =
*   T_STATUS_DESCRIPTION          =
*   S_RETURN           =
.
CLEAR: LV_EPERNR, LV_MPERNR, E_NACHN, E_VORNA, M_NACHN, M_VORNA.
READ TABLE LT_APPRAISEE INTO LS_APPRAISEE INDEX 1.
IF SYSUBRC = 0.
LV_EPERNR
= LS_APPRAISEEID.
ENDIF.

READ TABLE LT_APPRAISER INTO LS_APPRAISER INDEX 1.
IF SYSUBRC = 0.
LV_MPERNR
= LS_APPRAISERID.
ENDIF.

SELECT SINGLE * FROM PA0002 INTO LS_E0002 WHERE
PERNR
EQ LV_EPERNR.
E_NACHN
= LS_E0002NACHN.
E_VORNA
= LS_E0002VORNA.
SELECT SINGLE * FROM PA0002 INTO LS_M0002 WHERE
PERNR
EQ LV_MPERNR.
M_NACHN
= LS_M0002NACHN.
M_VORNA
= LS_M0002VORNA.

SELECT SINGLE USRID_LONG FROM PA0105 INTO E_ID WHERE
PERNR
EQ LV_EPERNR AND
SUBTY
EQ ‘0010’.

SELECT SINGLE USRID_LONG FROM PA0105 INTO M_ID WHERE
PERNR
EQ LV_MPERNR AND
SUBTY
EQ ‘0010’.

SWC_SET_ELEMENT CONTAINER ‘Emp_ID’ E_ID.
SWC_SET_ELEMENT CONTAINER
‘Man_ID’ M_ID.
SWC_SET_ELEMENT CONTAINER
‘E_NACHN’ E_NACHN.
SWC_SET_ELEMENT CONTAINER
‘E_VORNA’ E_VORNA.
SWC_SET_ELEMENT CONTAINER
‘M_NACHN’ M_NACHN.
SWC_SET_ELEMENT CONTAINER
‘M_VORNA’ M_VORNA.
SWC_SET_ELEMENT CONTAINER
‘APPR_ID’ APPR_ID.


Step 3: Create Custom Workflow to get details and send mail on event trigger.

T Code: SWDD

/wp-content/uploads/2015/12/image017_858990.jpg

Double click to insert activity step (Activity step is used to perform task and return values and container).

/wp-content/uploads/2015/12/image018_858991.png

Provide task details and step Name.

/wp-content/uploads/2015/12/image019_858995.jpg

Now, Create workflow container as like task container.

/wp-content/uploads/2015/12/image020_858996.png

Click double click to create workflow container element.

/wp-content/uploads/2015/12/image021_858997.png

Create all elements for which details is required in mail.

/wp-content/uploads/2015/12/image022_858998.png

For our scenario, below are details required for all mail.

/wp-content/uploads/2015/12/image023_858999.png

Now, important step. Binding of workflow container element to task elements. so that details fetched in task can be passed to workflow container correctly.

Do not generate automatically. Do it manually as shown below.

/wp-content/uploads/2015/12/image024_859000.png

Bind all shown elements.

/wp-content/uploads/2015/12/image025_859001.jpg

Now, include mail step to send mail.

/wp-content/uploads/2015/12/image026_859002.png

Provide details for mail step. For this workflow, i need to notify manager as Employee has submitted goal setting. So E-Mail Address as Manager Mail id.

User variable details fetched from task in mail step with & prefix and suffix.

/wp-content/uploads/2015/12/image027_859003.jpg

This is just done from workflow development. Now, to trigger workflow from event, need to configure start event.

Go to basic data as shown.

/wp-content/uploads/2015/12/image028_859004.jpg

Go to Start Events. Provide Standard BO APPR_DOC. Do not give custom BO ZAPPR_DOC.

As we have delegated ZAPPR_DOC to APPR_DOC, custom events will also be available in standard BO APPR_DOC.

Activate it in A column (Green).

Do binding. Here binding will help to pass appraisal document details (APPR_DOC) attributes. And as in code, we have used Appraisal ID to get detail.

Hence, this binding is very important.

/wp-content/uploads/2015/12/image029_859005.jpg

Do Binding as shown.

/wp-content/uploads/2015/12/image030_859006.jpg

This is all done from technical side. I learnt and found very interesting.

Now from configuration side.

Step 4: Configure events and bind in status change button in status flow.

T Code: OOHAP_BASIC.

In last option, workflow events, Create new entries in workflow events which you have created in BO.

Now, assign it in category, template.

T Code: PHAP_CATALOG.

Select all the events created and make it applicable to category and template.

Configure event on respective action button in status flow to trigger event and workflow.

Hope this configuration stuff is easy hence not uploaded images.

Hope this will help.

Thanks,

Ketul

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Very fruitful document. keep sharing.

      Thanks ketul.

      Author's profile photo Arnav Ghildial
      Arnav Ghildial

      So you have already gone through this..eh.. yeah Useful document indeed.