Workflow. Triggering an SAP Workflow When Editing HR Master Data
Workflow. Triggering an SAP Workflow When Editing HR Master Data"
Have you or your business users ever wanted to make working with HR master data a bit more dynamic than what’s typically seen in most enterprises in our region? Have you ever wished, even just once, to introduce some liveliness into what seems like a simple task—creating, editing, or deleting an infotype in Personnel Administration or Organizational Management? And by "liveliness," I don’t mean dynamic actions in PA. That lost its thrill long ago.
If your answer is yes, then I present to you a short note on how to trigger a workflow when editing HR master data. This workflow can serve an informational purpose or otherwise, depending on the requirements.
If your answer is no, you’re probably better off watching puppies on swings.
0. Objective
Trigger a workflow when creating a custom Personnel Administration infotype. Let’s assume the infotype number is 9500. Its layout is irrelevant for our purposes.
1. Creating a Business Object
Every workflow starts with the ritual of defining its triggering object, which can be either a business object or a class.
See the article: SAP Workflow. Business Objects and Events
For this demonstration, the primary business object is BUS1065
, from which delegation is configured to a newly created object ZBUS1065
.

An event has been created for the business object, with a name that intuitively indicates what must happen to the infotype record for the event to be triggered.

2. Creating the Workflow
Use transaction SWDD
to create a workflow that fulfills your business process requirements. To keep this note concise, a video segment is provided showing the following sequence:
- Creating the workflow
- Defining its triggering events
- Configuring workflow settings
- Creating a dialog task for user decision-making
At the end of this step, a skeleton workflow is created that will be triggered by actions on the infotype. Its internal details, frankly, are not our concern.
3. Assigning the Business Object to the Object Type and Infotype
Use transaction SWEHR1
.

4. Creating a Function Module to Trigger a Custom Event
SAP provides a number of preconfigured events and operations for infotypes (create, delete, update). You can view the list using transaction SWEHR2
.

You also have the option to create a custom function module to dynamically trigger an event, based on infotype data (before/after creation, update, or deletion). You can base your implementation on standard examples like HR_EVENT_RULES_PB4000
.

Let’s say, for demonstration purposes, the function module will contain the following logic:

5. Configuring the Link Between Object Type, Infotype, Operation, and Function Module
Configure the setup using transaction SWERH3
.

6. Testing
A simple test case:
- Create a record for infotype 9500
- Verify that the previously created function module is triggered
- Confirm that the workflow is launched upon saving the infotype record
Reference Materials
See: SAP Business Workflow
See: Creating Events when HR Master Data is Changed
Also refer to the SPRO path:IMG -> Personnel Management -> Personnel Administration -> Tools -> Business Workflow Events