cancel
Showing results for 
Search instead for 
Did you mean: 

Can workflow be auto approved ?

Former Member
0 Kudos
166

Hello Experts ,

We are on Sourcing 10  and have a requirement to implement workflow for project document . The workflow needs to be explicitly approved for a scenario . We are trying to find if we can do it by any script . Is it possible to approve workflow by some script. We are using multi level sequential workflow , it needs to approved 1st level by some script and it should go to 2nd approver who will approve as normal system approval .

Also is it possible to do auto approval if the workflow is pending with approver for few days time ?

Thanks for your help

Thanks

Sudipta 

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sudipta,

Although I haven't tried this functionality but I think there are methods to change the approval status of a document.

Package: com.sap.odp.api.workflow

Interface: WorkflowItemIBeanIfc

Method: setApprovalStatus(ApprovalStatusEnumType value)

eg: setApprovalStatus(new ApprovalStatusEnumType(new Integer(1)))

I think this would set the status to Approved.

Thanks,

Arijeet

Former Member
0 Kudos

Thanks Arijeet for your valuable suggestions .

I have tried the method in the below script but looks like not working . Please let me know if anything wrong in my code . Please note I am working on project document workflow and the below code I am just testing in a toolbar script . If works , will set in explicitly called script .

import com.sap.odp.api.workflow;

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

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

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


Ref=doc.getObjectReference();

WorkflowHome=IBeanHomeLocator.lookup(session,WorkflowItemIBeanHomeIfc.sHOME_NAME);

WorkflowHome.setApprovalStatus(new ApprovalStatusEnumType(new Integer(1)));

// WorkflowHome.approveWorkItem(Ref,"OK");

It gives me error -

Sourced file: inline evaluation of: ``import com.sap.odp.api.workflow; import com.sap.odp.api.workflow.WorkflowItemIB . . . '' : Error in method invocation: Method setApprovalStatus( com.sap.odp.api.workflow.ApprovalStatusEnumType ) not found in class'com.sap.odp.api.workflow.WorkflowItemIBeanHomeImpl'


One more method I am finding in RG -


approveWorkItem(ObjectReferenceIfc aWorkItemRef, java.lang.String aComment)

         

This also I have tried to use in the code ( commented ) . It does not give me any error but document is also not approved . Any Idea ?



Former Member
0 Kudos

Hi Sudipta,

Although I haven't tried the code but I think the way you have have called the method setApprovalStatus(new ApprovalStatusEnumType(new Integer(1))) is incorrect.

As per your code you have a class reference WorkflowHome. This method setApprovalStatus(....) is not a static so you would have to instantiate the class reference before using the method. So the code should look something like:

WorkflowHome=IBeanHomeLocator.lookup(session,WorkflowItemIBeanHomeIfc.sHOME_NAME);

workflowItem = WorkflowHome.findByDocument(do.getObjectReference());

workflowItem.setApprovalStatus(.....);

Try this and let me know if it works.

Also, let me know in which package does approveWorkItem exist. I couldn't find it. But I think this will work within the XPDL directly (need to check this)

Thanks,

Arijeet

Former Member
0 Kudos

Thanks Arijeet  let me try and get beck to you .