Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document is part 6 of what builds on my other example: " Part 5: basic HCM Process and Forms scenario (Backend Service)" which can be accessed  at: http://scn.sap.com/docs/DOC-35622

You can use any HCM Process you have created for this sample Workflow exercise. The objective of the exercise is to know how to create a WorkFlow for use with HCM Process and Forms.  For this example I will use the ZPR6 process that I have been building on in the prior exercises.

Create a Workflow Template and select the “Workflow Builder” button:

Since this WF will communicate with the Process Object from Process and Forms, we need to add a custom container element to allow the data exchange using CL_HRASR00_WF_PROCESS_OBJECT.

Open the WF Container and double-click “Double-Click to Create”:

Enter the new container element as follows:

Now we need to specify that the workflow template will be started by the event “TRIGGERED” from class CL_HRASR00_WF_PROCESS_OBJECT. The procedure follows:

  1. Choose Basic Data for your workflow template (if it is not already displayed).
    1. Use this icon: 
  2. Choose the Version-INdependent (Task) tab page.
  3. Choose the Start Events tab page.
  4. Enter the object type category CL.
  5. Enter the object type CL_HRASR00_WF_PROCESS_OBJECT.
  6. In the Event of the Object field, select the TRIGGERED entry.
  7. Save your work.
  8. Specify the data flow. To do this, choose the pushbutton in the Binding
    column.
    1. The “Change Binding for Workflow” dialog box appears. Just close it.
  9. Choose the Activate icon.
    1. Use this icon:  
  10. Choose Exit Binding Editor.
    1. You return to the maintenance screen for basic data. The pushbutton in the
      Binding column now has the status binding (Existing).
  11. Save your workflow template.

Result:

Since we have now added the custom container element for the Process Object, we need to define a programming exit so that the WF can communicate with the process object. In Basic Data, choose Version-Dependent (Current Workflow Version) tab page.  Choose the Program Exits tab and enter: CL_HRASR00_POBJ_WF_EXIT. Press the enter key to check.  See below for results:

Now we have defined our basic WF shell, we also need to setup Event Type Linkage.  This allows the process object to fire our start up event (TRIGGERED) and have a listener waiting to start the WF.  For this we use transaction: SWETYPV select the following entry for your WF: (mine is WS90300159)

Result:

Select the row and then choose “Details”.  Enter HR_ASR_CHECK_EVENT in the Check Function Module field and then save you changes:

Now you are ready to actually add some steps to the WF which will process the form. Display the “My Workflows and Tasks” menu bar:

  1. Choose Components for HCM Processes and Forms.
  2. Choose Task Groups.
  3. Choose TG17900002 (Interactive Components in HR ASR Dir.).
  4. Click and drag TS17900100 (Process Form) onto the Graphical Model area (the
    mouse pointer changes to a plus symbol to show you where you can insert the
    step) just in front of the undefined step.
  5. Delete the Undefined template step by right-clicking the icon and selecting
    Delete.
  6. Save your workflow template.

Result:

Double-click the new “Process Form” icon in the Graphical Model area to display the Process Form workflow step details and enter wf_initiator as follows:

What did we do? We created a single step WF which sends the “Process Form” task to the initiator.  The initiator will receive an inbox item which they can process and update the SAP back end.  This is obviously not a real world scenario, but I’m just trying to show how to create the WF.  You will have some other business process.

Choose the “Binding (Exists)” pushbutton and make the following changes:

  1. In the Workflow column, click the drop-down list in the “&SEND_VARIATION&” row.  The Select Expression dialog box appears, listing the container elements of the workflow template.
  2. Choose the Enter Constant pushbutton. The system extends the dialog box to display fields for constants.
  3. From the dropdown list in the Constant field, select “A” (Write Data to Application Database). Choose Continue. “A” (Write Data to Application
    Database) now appears in the ‘Relocation’ Workflow column.

Result:

Determine the form scenario to use (Ties our WF Step to our form scenario).

  1. In the Workflow column, click the dropdown list on the “&FORM&” row. The Select Expression dialog box appears.
  2. Choose the Enter Constant pushbutton on the dialog box toolbar. The system extends the dialog box to display fields for the (Form) Scenario and (Form
    Scenario) Version.
  3. Select your form scenario name.  For me it is ZFS6 and version 0000.
  4. Choose Continue. The details for the form scenario now appear in the ‘Relocation’ Workflow column.

Result:

Determine the form scenario step to use (Ties our WF Step to our form scenario STEP).

  1. In the Workflow column, click the drop-down list in the “&FORM_SCENARIO_STAGE&” row.  The Select Expression dialog box appears.
  2. Choose the Enter Constant pushbutton. The system extends the dialog box to display fields for the form scenario and its steps.
  3. Using the dropdown lists in these fields, select the form scenario name.  For me it is ZFS6 and version 0000.  Then select the scenario step “DEFAULT”.
  4. Choose Continue. The details for the form scenario step now appear in the Workflow column.

Result:

For this WF step, we need to add the needed Program Exit to communicate with the HRASR framework.  Select the Program Exits tab for this task and enter the following class: CL_HRASR00_POBJ_WF_EXIT:

Now we need to tell the Workflow which Form Scenario we expect it to use. 

Display your WF container and double click the container element “FORM”.  Go to the “Initial Value” tab and enter your scenario:

Save and Activate your WF.  The simple WF is now completed.  However, you now need to tell your process to use the WF.  Go to your process in design
time and add this WF ID to your configuration as follows:

Now you can test your form.  If you fill out the form, you will also get the WF in your inbox.  The inbox I’m referring to is the HCM Process and Forms inbox which you can access via the portal (or just use transaction SWIA to see the WF in the WF tool).  Remember, you set the WF task to be processed by the initiator.  This is just a basic example of creating the WF for Process and Forms.  It should be everything you need as a foundation for creating much more extensive business process workflows in P&F.  Have fun.

19 Comments
Labels in this area