Skip to Content

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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”:

/wp-content/uploads/2013/02/p_187285.jpg

Enter the new container element as follows:

/wp-content/uploads/2013/02/p_187285.jpg

/wp-content/uploads/2013/02/p_187285.jpg

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:  /wp-content/uploads/2013/02/pic__187284.jpg
  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:   /wp-content/uploads/2013/02/pic__187284.jpg
  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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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)

/wp-content/uploads/2013/02/pic__187284.jpg

Result:

/wp-content/uploads/2013/02/pic__187284.jpg

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

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

  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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/p_187285.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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:

/wp-content/uploads/2013/02/pic__187284.jpg

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.

To report this post you need to login first.

18 Comments

You must be Logged on to comment or reply to a post.

  1. Christopher Solomon

    Nicely documented! You hit all the major ones that folks forget (ie. assigning the HRASR class and setting up linkage correctly). The rest is pretty much usual ol’ workflow from there. haha

    (0) 
  2. Christiaan Hilkman

    Hello Philip,

    I’ve also set up the “Process Form”-step, and after executing the process (via Transaction HRASR_DT) I have an entry waiting in my inbox. Problem is, that it will not open: Work item can only be executed using the Portal and the UWL.
    This message shows up in SBWP and NWBC.
    But I don’t have a Portal!
    What did I do wrong?

    Thanks,

    Christiaan

    (0) 
    1. Christopher Solomon

      You have to make certain “visualization” (SWFVISU) settings for those particular workflow tasks so that they know how to “launch” from an inbox. Also, if using the Portal, this requires some similar UWL configuration.

      (0) 
      1. Christiaan Hilkman

        Hello Christopher,

        thanks for the hint, but unfortunately it does not change anything.
        Visualization Type for Task TS17900100 was “WebDynpro Java”. I first changed it to “WebDynpro ABAP”, but the message still appears (also for newly created item). The same also for Visualization Type “BSP Standard”.
        Please advice.

        Thanks,

        Christiaan

        P.S. your blogs about HCM Processes & Forms were very valuable to me and helped me out a lot. Thanks for that.

        (0) 
        1. Christopher Solomon

          It depends on WHICH task you are talking about. You don’t just change them around till one works (haha). Some are Jave WD but the newer ones (FPM based) are going to be new entries you have to make in that table. Also, I think there are some NWBC specific settings you might need to make. Hunt around for “visualization of workflow task” and things like that to find info.

          (0) 
          1. Christiaan Hilkman

            The task I’m talking about is the same as in the article above and which I stated in my last response: TS17900100 (Process Form).

            The Form it should display is one created in FPM. The FPM Form is shown when I execute (test) my process via transaction HRASR_DT. In the workflow I want to call the form again, but with a different form scenario step. A task is created in my inbox but cannot be opened.

            (0) 
            1. Christopher Solomon

              There are different tasks for “Process Form” for Adobe vs FPM forms. (sorry, not looking up the task IDs right now and don’t have them memorized haha). In fact, there are different ones for all of them (process/edit, approve, forward to expert, etc). Look in the help.sap.com documentation for your version for info on setting these up. Again, it is the “visualization” that is throwing the error (ie. it thinks it is trying to run an application in the GUI which is set to only run in the portal).

              (0) 
  3. Former Member

    Hello Philip,

    I have two issues in the process workflow :

    first :  workitem not appear in UWL even its appear in sap business workflow and in workflow log for the right agent

    Second : record saved to backend once the workflow start even the first step still in ready stats

    Regards

    Ghadeer

    (0) 
    1. Christopher Solomon

      I know you asked Phil, but I will jump in for a quick reply to you….

      1. make sure you have configured the UWL for the HCM P&F tasks. Similarly, you need to make sure the “visualization” settings/config is right (SWFVISU).

      2. Your configuration is wrong….sounds like you have your process “start” still set to “write to application database” versus “do not tolerate errors” or other option (forget right now). That means your process will ALWAYS save from the start even if you have workflow attached. Easy one to miss.

      (0) 
      1. Former Member

        Thanks Chris. 🙂

        for the first one I have followed the 1702012 SAP Note but still not appear 🙁 even Adobe Task appear in UWL , please help me to fix it , i found the same issue but the solution not clear in the below thread :

        FPM forms and UWL

        For the second I have follow the above blog but with FPM Tasks , i didn’t change any of container element that affect on backend (I keep the default values) , i created sample

        workflow with one step , but its still saved to backed once the process started before the first step of workflow completed 😥

        Regards

        Ghadeer

        (0) 
          1. Former Member

            ahaaaa, its fine now 😳 thanks

            Chris is it important to implement the following step , even if i wan to open it from NWBC not from portal :


            Ensure that you register/re-register the system in the portal after the task visualization is updated in SWFVISU.


            Regards

            (0) 
  4. Former Member

    Hi Philip/Christopher,

    Your documents have helped a lot as I started the configuration of HCM Processes.

    I am facing an issue with the end of HCM Process. I am able to create a form, and on saving a locked entry is created in infotype with the changed data. The details are then sent to for approval.

    On Approving the form (I am using task id: TS17900101), the workflow is completed. However, the infotype locked entry remains locked, and the record is not delimited as it should after approval.

    Is there any step that I am missing. One thing that I noted was that task id: TS17900101 does not allow me to use &SEND_VARIATION& element.

    Best Regards,

    Rohit

    (0) 
    1. Christopher Solomon

      The “approve” is really just a “yes or no” check for the user….it just passes a “approve” or “reject” to workflow…it is then up to you (the workflow developer) to determine what that means (ie. how you workflow behaves….”if answer = approve then do this…else if answer = reject then do this”…..so nothing automatically happens. You would then in your workflow have to “do” whatever on approval…for instance, use the background task to update the record to unlock and delimit as you need.

      (0) 

Leave a Reply