cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Approval & Sequential Approval In CLM Workflow

ritikbaral
Explorer
0 Kudos

Hi All,

We have a new requirement for the CLM Workflow, where we have the two type of  approval functionality. One is sequential and the other is parallel approval.

In Sequential Approval , if there are 4 user listed as approver , then the approval should be done on the sequential basis.

In Parallel approval: If there are 3 approver , Upon approval by all three, the workflow is complete.  Upon rejection by any of the three, the phase is reverted back to the previous phase.  The user can make the appropriate changes, then move the contract back to the Approval phase, where the workflow will kick off again.

Please throw some light on achieving the above functionality. We have worked on the Group Approval before but not on the Parallel & Sequential Approval.

Thanks,

Ritik

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ritik,

For sequential approval it looks like you need a four gate workflow set up. Each gate in the approval process will find the correct approver using prescript and then send the document to the user for approval, once approved the workflow will move onto the next gate and repeat the process. If any of the four approvers reject the document it will return the document to the previous phase.

There is a lot of good information on setting up sequential approval in the Scripting and Workflow Guide for SAP Sourcing guide that can be found on the service market place.

As far as I am aware parallel approval is not possible, the only way to implement parallel approval is to use user groups as you have done previously.

I hope this helps.

Thanks

Dan

ritikbaral
Explorer
0 Kudos

Hi Dan,

Thanks a lot for your prompt reply. I appreciate all your help.

The sequential approval logic has been changed a bit. Following is the example.

EXAMPLE 1 – Sequential review/approval only

Name

Role

Type of Approval

User 1

Owner

None

User 2

Approver

Sequential

User 3

Approver

Sequential

In this scenario, upon User 2’s approval, the workflow is complete. Upon rejection by either User 2 or User 3, the phase is reverted back to the previous phase.  The user can make the appropriate changes, and then move the contract back to the Approval phase, where the workflow will kick off again.

Under the collaborator section for Master Agreement we will add one more extension, which will specify the type of approver sequential or Parallel. The Confusion is How will I iterate through this list of approver and pick the approver and the type of approval.

The other concern is in case of Parallel approval how will I know which users have already approved the contract document.

EXAMPLE 2 – Parallel approval only

Name

Role

Type of Approval

User 1

Owner

None

User 2

Approver

Parallel

User 3

Approver

Parallel

User 4

Approver

Parallel

In this scenario, User 2, User 3, and User 4 can approve in any order. Upon approval by all three, the workflow is complete.  Upon rejection by any of the three, the phase is reverted back to the previous phase. The user can make the appropriate changes, and then move the contract back to the Approval phase, where the workflow will kick off again.

Thanks,

Ritik


Former Member
0 Kudos

Hi Ritik,

Looking at your requirement I think both cases would need to be handled through workflow prescript. The prescript will automatically add the appropriate approver to the master agreement collaborator section.

In the case of your sequential approval you could add two extension fields to the master agreement header called sequential approver 1 and sequential approver 2 containing users, the prescript will then pull the correct user into the collaborator section as an approver at the start of each of the approval gates. There are examples of this in the SAP workflow guide I mentioned in my first post that will hopefully help you create this.

With the parallel approval I think the only way to do this is to use groups and add an extension on the header called parallel approval group where the user can select a group containing the appropriate three users. You can then use prescript to bring this group into the collaborator section and using the below code in your prescript will make all three approve before the document is approved.

addApprover(<user group object reference>,

new CollaboratorApprovalRuleType(1));

All the above information is from my experience with creating workflow, if anything I have said is wrong hopefully a more experienced forum member will be able to correct it.

Thanks

Dan

ritikbaral
Explorer
0 Kudos

Hi Daniel,

Sorry i was in transit, so could not reply to your post. I came across some SAP documentation which says, Parallel Approval is not possible in SAP E-Sourcing. I am not sure on this. Have you done any kind of Multi-Activity workflow of SAP eSourcing before. If yes , can you please share the code/documentation. It will be a great help.

Thanks a lot for your help.

Thanks,

Ritik

Former Member
0 Kudos

Hi Ritik,

I have used multiple gate approvals in Sourcing.

I started with the standard SAP XPDL files and changed the workflow prescript in Together Workflow Editor 2.11 to suit my requirements.

For example my requirement was a 2 gate approval where if the first approver approved the workflow it then went to the second approver, if either approver rejected the workflow it went back to the start.

To achieve this I started with the SAP 3 gate example file and removed one of the gates and then added the below prescript to use extension fields on the project header containing groups for the approvers. I used a different extension field for each approval gate so the only change in the prescript was the name of the extension field.

import com.sap.odp.api.common.exception.*;

import com.sap.odp.api.common.log.Logger;

import com.sap.odp.api.common.platform.*;

import com.sap.odp.api.common.types.*;

import com.sap.odp.api.doc.collaboration.*;

import com.sap.odp.api.ibean.*;

import com.sap.odp.api.util.*;

import com.sap.odp.api.workflow.*;

import com.sap.eso.api.projects.*;

import com.sap.eso.api.doccommon.masterdata.*;

import com.sap.odp.api.doccommon.masterdata.*;

import com.sap.odp.api.common.log.*;

import com.sap.odp.api.usermgmt.masterdata.*;

import com.sap.odp.api.doc.collaboration.*;

// Step 1: Add level 1 approver from Project Header

// These hold the name of the extension fields we are concerned

// with.

level1ApproverExtName = "Level1AppGrp";

// Create a logger for messaging

logMsg = Logger.createLogMessage(session);

// Level 1 Approver

principal =doc.getExtensionField(level1ApproverExtName).get();

if (hasValue(principal))

{

// Add the user account as the approver

    addApprover(principal,new CollaboratorApprovalRuleType(0));

   

    // log details

    logMsg.setLogMessage("Added user: " + principal.getDisplayName() + " as approver");

    Logger.info(logMsg);

}

I hope this helps.

Dan

ritikbaral
Explorer
0 Kudos

Hi Dan,

Thanks a lot for your constant help on this. The SAP 3 gate approval is quite useful. Now i am able to implement multi-gate or multi-activity workflow logic.

In my case i am adding the approver from the existing collaborator collection table . For that i have applied the following logic:

// Get the default collection "COLLABORATORS"

collaboratorsCollection = doc.getCollectionMetadata("COLLABORATORS").get(doc);

// Check if collaborators collection's size is greater than zero.

if (collaboratorsCollection.size() > 0)

{

// Iterate over the collection.

for (int i = collaboratorsCollection.size() - 1; i >= 0; --i)

  {

// Get collection member

        collaboratorsCollection_member = collaboratorsCollection.get(i);

// Check if member has value.

       if (hasValue(collaboratorsCollection_member))

       {

// Get the collaboration role of the collection member.

          collaboratorRole = collaboratorsCollection_member.getCollaboratorRole().getDisplayName();

// Get approver of Role "Buyer contractor hiring".

           if(collaboratorRole.equals("Buyer contractor hiring"))

           {

                principal = collaboratorsCollection_member.getPrincipal();

           }

       }

  }

}

// Create a logger for messaging

logMsg = Logger.createLogMessage(session);

if (hasValue(principal))

{

// Add the user account as the approver

    addApprover(principal);

    // log details

    logMsg.setLogMessage("Added user: " + principal.getDisplayName() + " as approver");

    Logger.info(logMsg);

}

But in this case for some reason its not going inside the if statement :

// Check if collaborators collection's size is greater than zero.

if (collaboratorsCollection.size() > 0)

{

}

I checked my Collaborator collection & it has a list of approver .

Is something wrong with the way i am trying to iterate over the collaborator collection.

Thanks,

Ritik

Former Member
0 Kudos

Hi Ritik,

I have very limited knowledge of scripting, if you are seeing a problem with the first IF statement then possibly you could try:

collaboratorsCollection = doc.getCollaborators();

collaboratorsCollectionsize = collaboratorsCollection.size();

if(collaboratorsCollectionsize > 0)

Hopefully someone with more scripting experience than me will be able to help you if there are problems with the script.

Regards

Dan

ritikbaral
Explorer
0 Kudos

Thanks a lot Dan for your constant help. The above code was useful.

ritikbaral
Explorer
0 Kudos

Hi Daniel,

I am facing the following issue while moving the Workflow phase from Legal Review Supplier Draft  or from Legal Review à Draft.

The following are the phases we currently have:

  1. Draft.
  2. Legal Review (Workflow Attached)
  3. Supplier Draft
  4. Waiting for Internal Approval.
  5. Executed.
  6. When I am moving the phase DraftàLegal Review .  I am expecting once the document is approved, it should move to Supplier Draft. But its saying ‘Error Moving to Supplier Draft Phase, Supplier Draft is not a valid next or previous phase’. Same way when its rejected it should move to ‘Draft’ Phase.

When I checked the code by putting the log message in the Post Script, I found that the Post Script is getting executed twice. I am clueless why it’s getting executed twice.

In the post script for the 1st time its saying the current phase is ‘Draft’ and in the next time its saying the current phase is ‘NULL’.

Following is the code for Post Script.

import com.sap.odp.api.common.exception.*;

import com.sap.odp.api.common.log.Logger;

import com.sap.odp.api.common.platform.*;

import com.sap.odp.api.common.types.*;

import com.sap.odp.api.doc.collaboration.*;

import com.sap.odp.api.doc.IapiDocumentLockManager;

import com.sap.odp.api.doccommon.masterdata.*;

import com.sap.odp.api.ibean.*;

import com.sap.odp.api.util.*;

import com.sap.odp.api.workflow.*;

import com.sap.odp.api.projects.*;

import com.sap.odp.api.common.log.*;

import com.sap.odp.api.ibean.*;

import com.sap.odp.api.usermgmt.masterdata.*;

import com.sap.odp.api.doc.collaboration.*;

// The final step of the approval process moves

// the phase of the Project to Approved

// (if all approvals were made) or back to xxx

// (if there was a denial).

// Create a logger for messaging

logMsg = Logger.createLogMessage(session);

// If we are not approved, then change the phase backward

if (getApprovalStatus() != APPROVED)

{

  

    home = doc.getIBeanHomeIfc();

home.upgradeToEdit(doc);

logMsg.setLogMessage("-----Current Phase is:"+doc.getCurrentPhase().getDisplayName()+"-----------");

Logger.error(logMsg);

    if (!doc.getCurrentPhase().equals("Draft"))

    { 

    try

    {

home.changePhase(doc,"Draft");

    }

    catch(e)

    {

logMsg.setLogMessage(e.toString());

logMsg.setException(e);

Logger.error(logMsg);

    }

    }

}

// If we are approved, change the phase forward

if (getApprovalStatus() == APPROVED)

{

    home = doc.getIBeanHomeIfc();

home.upgradeToEdit(doc);

    try

    {

home.changePhase(doc,"Supplier Draft");

    }

    catch(e)

    {

logMsg.setLogMessage(e.toString());

logMsg.setException(e);

Logger.error(logMsg);

    }

}

logMsg.setLogMessage("Completed Workflow");

Logger.error(logMsg);

Looking forward for your help.

Thanks,

Ritik

ritikbaral
Explorer
0 Kudos

Hi Daniel,

Thanks for all your help.

We are facing a strange issue in our Multi-Activity Workflow. We have defined 3 gates/activity in our workflow. For this we have added 3 user as approver . When we are executing the Workflow , each approver is getting the Approval Work Item Thrice, so its getting executed 9 times, instead of 3 times.

When i added only one approver, it got executed thrice.

Have you faced this issue before with the Multi-Activity Workflow.

Thanks,

Ritik

Former Member
0 Kudos

Hi Ritik,

The approvers should only be added to the collaborator table by the workflow prescript that is against each of the three approval gates.

When the workflow is started the approver defined in gate 1 workflow prescript should be added as the approver and asked to approver the document. Once this user has approved the document their collaborator role should be changed as set out in the Sourcing workflow definition, for example it will change them to a reviewer. Once this is done the gate 2 approval will start and the gate 2 prescript will add approver 2. In this way only one approver is added at once and there will be three approvals in the flow.

Regards

Dan