on 06-11-2012 1:06 PM
Hi All,
I have written a script to retrieve the current status of contract document but its not showing the expected result. I have approached to this issue by various ways as provided below :-
1) Tried to extract it using field id "CURR_CONFIG_PHASE". But its giving null.
2) Tried to extract the value by using collection "WORKFLOW_HISTORY" whose field id "DISPLAY_NAME" supposed to give the current status. But its also giving null.
3) Tried to extract the same field value "DISPLAY_NAME" of "WORKFLOW_HISTORY" through the script which retrieves its value directly from database. This time its giving status as "Draft" i.e. the initial status, its not giving the current status.
Can anyone suggest me some other approach for the same.
Your help is appreciated.
Thanks.
Hi,
I have tried this getCurrentPhase() method but it will give answer only when the contract document is in initial phase i.e. Draft. After we change the phase it will give null.
So I have tried with the alternative by using collection "WORKFLOW_HISTORY" whose source code is provided below :-
id=doc.getObjectReference().getObjectId();
workFlowCollection = doc.getCollectionMetadata("WORKFLOW_HISTORY").get(doc);
Iterator workFlowCollection_iterator=workFlowCollection.iterator();
if(workFlowCollection.size()!=null)
{
while(workFlowCollection_iterator.hasNext()){
workFlowCollection_member = workFlowCollection_iterator.next();
ApplicationException db4 = new ApplicationException(session);
try
{
dbHandle = session.getDbHandle();
dbHandle.beginTransaction();
//throw doc.createApplicationException(null,id1.toString());
currentPhase= dbHandle.executeIsolatedQuery("SELECT DISPLAY_NAME FROM FCI_DOC_WORKFLOW_HISTORY WHERE PARENT_OBJECT_ID ="+id);
throw doc.createApplicationException(null,currentPhase);
dbHandle.endTransaction();
}
catch (Exception e)
{
db4.chainAtEnd(doc.createApplicationException("null",e.getMessage()));
}
}
}
But its showing currentPhase as "Draft" only. Can anyone let me know how to extract the actual status.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anshu,
Status field belongs to Master Agreement.if you want to retrive the status of current phase you can write a script with class:contract Document 2002,Traget:validate
The following is the script
import com.sap.odp.api.common.types.AttachmentIfc;
import com.sap.odp.api.common.types.LocalizedObjectReferenceIfc;
import com.sap.odp.api.doc.IapiDocumentLockManager;
import com.sap.odp.api.ibean.metadata.IBeanFieldMdIfc;
String CLASS_NAME = "VALIDATION OF ATTACHMENT";
String ERR_MES = " FILE NOT ATTACHED";
LocalizedObjectReferenceIfc currentphase = (LocalizedObjectReferenceIfc)doc.getCurrentPhase();
//doc.setDocumentDescription("current phase" +currentphase.getDisplayName());
doc.setDocumentDescription("current phase"+current_phase.toString());
In Description you will get current phase status.
Regards,
pallavi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.