Skip to Content
Product Information

How to Model Workflow Definition for Collaboration in SAP S/4HANA Cloud for Intelligent Product Design?

“SAP S/4HANA Cloud for intelligent product design offers an ultimate cloud-based solution that empowers you to design your digital products faster. The solution consists of the collaboration and engineering capabilities.”

– SAP S/4HANA Cloud for Intelligent Product Design


Content:


Introduction

Using the Collaboration offering of SAP S/4HANA Cloud for intelligent product design (IPD); you can collaborate with internal and external participants, using documents, design models (2D and 3D) and product data (like BOM).The process can be driven leveraging the SAP Cloud Platform Workflow integration within collaboration.

As a Solution Administrator; you have to model and deploy the workflow definition according to the configurations, as defined in the Administration Guide for the product. This blog provides you an insight on how to model workflow definitions for collaborations in IPD.


Getting Ready to Model Workflows for IPD

Detailed Product Documentation – Live Product Cockpit and Collaboration

For the purpose of this blog, process flow for Document Review is taken as an example to model a sample workflow. Assume that in the document review process, the following tasks are to be accomplished:

  1. Review and Update – a user task is required to complete the document review process
  2. Approve – a user task is required to complete the document approval process

Access and Authorization to Workflow Editor

  1. You should be on-boarded to the tenant/account (Onboarding)
  2. You are added to the recommended User Group COLLABORATION_ADMIN OR you should have the following roles, (User Actions and Required Roles of Collaboration)
    • DiDeveloper role from Subaccount sapwebide and Application di
    • WorkflowDeveloper role from Subaccount bpm and Application bpmworkflowruntime 
  3. Go to SAP Web IDE Full-Stack service (url pattern : webidecp-<tenantId>.dispatcher.hana.ondemand.com)
  4. Go to Preference > Workspace Preferences > Extensions (Add-ons)
  5. Enable the Workflow Editor extension and Save (ref: link)

Creating a Workflow Project

  1. Go to your Workspace
  2. File New > Project from Template > Workflow Project
  3. Input a project name (DocumentReview) and workflow name (DocumentReview) and Finish (ref: link)

Modeling the Workflow Definition for Collaboration in IPD

To model workflows for IPD, you have to define authorizations for workflow definitions via prerequisite script and service tasks as defined in the Administration Guide.

Defining Authorization tasks for workflows

There are two ways you can do this,

Option 1 : Using JSON code in the guide procedure

  1. Go to – Define Authorizations for Workflows
  2. Copy the code sample in Step 6
  3. Go to your Workspace in SAP Web IDE Full-Stack
  4. Select the workflow file (DocumentReview) under the workflow project (DocumentReview)
  5. Right click and Open with > Code Editor
  6. Replace the existing code in the file with code copied from IPD Administration Guide
  7. Search for and replace “NEW_WORKFLOW_NAME” with the name that you entered (DocumentReview), and then save the changes
  8. Close the code editor and open the workflow in Workflow Editor
  9. You’ll see the following snippet;
  10. On opening the workflow in Workflow Editor, you can view/edit Workflow Properties from the right window (as shown below); make sure the Subject is set to ${context.subject} and Business Key is set to ${context.businessKey}

Option 2 : Using Workflow Editor in SAP Web IDE Full-Stack

  1. Go to your Workspace in SAP Web IDE Full-Stack
  2. Select the workflow file (DocumentReview) under the workflow project (DocumentReview)
  3. Open the file in Workflow Editor
Step 0:
  1. Input the Workflow Properties from the right window; set theSubject to ${context.subject} and Business Key to ${context.businessKey}
  2. Select the End Event and check/select/enable the Terminate checkbox
  3. Select the Start Event
  4. Go to Gateways select Parallel Gateway
  5. Parallel Gateway is added; name it ParallelGateway_Update
Step 1: Creating setReqObjForWFValidation Script Task
  1. Select the Parallel Gateway
  2. Go to Tasks and select Script Task
  3. Input Script Task Name as setReqObjForWFValidation
  4. Create a new Script File with name setReqObjForWFValidation
  5. Go to – Define Authorizations for Workflows
  6. Copy the code sample in Step 7 for Script File setReqObjForWFValidation
  7. Open the setReqObjForWFValidation script file in the SAP Web IDE Full-Stack and paste the copied code
  8. Save the script and workflow file
Step 2: Creating validateWFInitiatorForCollaboration ServiceTask
  1. Select the Script Task setReqObjForWFValidation
  2. Go to Tasks and select ServiceTask and input the Service Task Properties Name as validateWFInitiatorForCollaboration
  3. Go to Details section of the Service Task Properties; input the Destination as cpdcWF (this destination needs to be configured on the account – ref: Configuring Basic Destinations)
  4. Select Others in Choose a Service from option
  5. Input the Path as /service/validate/int/WorkflowValidation
  6. Select HTTP Method as POST
  7. Input Request Variable as ${context.reqBody}
  8. Input Response Variable as ${context.workflow.status}
  9. Enable the Principal Propagation option and Select Flow Event as the Start Event
  10. Save the workflow
  11. Select validateWFInitiatorForCollaboration Script Task
  12. Go to Gateways select Exclusive Gateway
  13. An Exclusive Gateway is added; name it isInitiatorValidForCollaboration
Step 3: Creating setInstanceLevelPermission Script Task
  1. Select the Exclusive Gateway
  2. Similar to “Step 1: Creating setReqObjForWFValidation Script Task”, create the Script Task with name setInstanceLevelPermission
  3. Save the workflow
Step 4: Creating deleteInstance Script Task
  1. From the left options panel, go to Tasks and add a Script Task with name deleteInstance
  2. Select the Exclusive Gateway isInitiatorValidForCollaboration
  3. Go to Sequence and drag to connect to the Script Task deleteInstance
  4. Select this newly created Sequence
  5. Input the Name in the Sequence Flow Properties window on the right as InValidInitiatorSequence and input the Condition as ${context.workflow.status == “DELETE”}
  6. Select the Sequence Flow from the Exclusive Gateway to Script Task setInstanceLevelPermission
  7. Input the Name in the Sequence Flow Properties window on the right as ValidInitiatorSequence and select the Default checkbox
  8. Select Script Task deleteInstance
  9. Go to Events and select End Event
  10. Save the workflow
Step 5: Creating setReqObjForFetchingUpdatedUsers Script Task
  1. From the left options panel, go to Events and add an Intermediate Message Event with name updatePermissionEvent
  2. Go to the Details section of the Intermediate Message Event Properties window on the right and input the Message Name as updatePermissionMessage
  3. Select the Parallel Gateway ParallelGateway_Update
  4. Go to Sequence and drag to connect to the Intermediate Message Event updatePermissionEvent
  5. Select the Intermediate Message Event updatePermissionEvent
  6. Similar to “Step 1: Creating setReqObjForWFValidation Script Task”, create the Script Task with name setReqObjForFetchingUpdatedUsers
  7. Save the workflow
Step 6: Creating getUpdatedUsersService Service Task
  1. Select Script Task setReqObjForFetchingUpdatedUsers
  2. Go to Tasks and select Service Task
  3. Input the Service Task Properties Name as getUpdatedUsersService
  4. Similar to “Step 2: Creating validateWFInitiatorForCollaboration ServiceTask”; go to Details section of the Service Task Properties; input the details as before
  5. Save the workflow
Step 7: Creating setUpdatedPermissions Script Task
  1. Similar to “Step 1: Creating setReqObjForWFValidation Script Task”, create the Script Task with name setUpdatedPermissions 
  2. Select the Script Task setUpdatedPermissions
  3. Go to Sequence and drag to connect to the Intermediate Message Event updatePermissionEvent
  4. Save the workflow
Below is a snippet of how the modeled workflow should look like

Defining custom tasks for workflows

Now you are ready to model the workflow by appending the tasks you want to accomplish. We shall take the Document Review tasks to define custom tasks for a workflow for collaboration in IPD.

Adding a User Task for Review and Update step

  1. Open the workflow(with authorization tasks defined) in Workflow Editor
  2. Select the Script Task setInstanceLevelPermission
  3. Go to Tasks and select User Task
  4. Input the User Task name (Review and Update) in the General section for the User Task Properties on the right window (as shown below); add any additional documentation that you would like the definition to have, make sure the checkbox for Show in inbox workflow log is selected
  5. Go to Details section for the User Task Properties; select task Priority, input a task Subject(Review and Update), input a task Description, input the Users field as ${context.sContributor} (you would need to configure this property in Workflow Properties application for the account) and if Due Date is required, select the Configure Due Date checkbox
  6. Go to User Interface section for the User Task Properties; select Type as SAPUI5 Component, input HTML5 App Name as html5apps and input SAPUI5 Component as com.sap.s4idea.cpdc.ui.task
  7. Save the workflow
  8. User Task for Review and Update step is completed

Adding a User Task for Approve step

  1. Similar to the previous step, create a User Task for Approve step
  2. Select the User Task added in the previous step
  3. Go to Tasks and select User Task
  4. Input the User Task name (Approve) in the General section for the User Task Properties on the right window; add any additional documentation that you would like the definition to have, make sure the checkbox for Show in inbox workflow log is selected
  5. Go to Details section for the User Task Properties; select task Priority, input a task Subject(Approve), input a task Description, input the Users field as ${context.sContributor} (user would need to configure this property in Workflow Properties application for the account and if Due Date is required, select the Configure Due Date checkbox
  6. Go to User Interface section for the User Task Properties; select Type as SAPUI5 Component, input HTML5 App Name as cpdctask and input SAPUI5 Component as com.sap.s4idea.cpdc.ui.task.Component

  7. Save the workflow
  8. User Task for Approve step is completed
  9. Save the workflow

The workflow definition Document Review is modeled and ready for deployment to cloud platform.

PS – Please share your feedback and write to me if you have any follow-up.
2 Comments
You must be Logged on to comment or reply to a post.