on 10-25-2007 8:02 AM
Hi Experts,
I created simple GP process with 3 Levels. Every level user i should assign dynamically.
For that i created one input parameter like userId. I mapped this parameter to filled with context parameter option in Block.
I need to start this process from Webdynpro application. My problem is if map UserID in Block means, i am not able to start process. With out mapping i am able to start process, But user is not dynmically.
I am getting Exception like:
com.sap.caf.eu.gp.exception.api.GPEngineException: Role Action4 may not be overwritten during instantiation
I am sending code how i am starting the process
IGPProcess process = null;
try {
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
wdComponentAPI.getMessageManager().reportSuccess("current user is : " + user.getFirstName());
IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);
process =GPProcessFactory.getDesigntimeManager().getActiveTemplate(processId,userContext);
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
int rolenum = process.getRoleInfoCount();
IUser dyn_User = UMFactory.getUserFactory().getUserByLogonID(wdContext.currentContextElement().getSel_PA_Name_Element()); //written by hari
wdComponentAPI.getMessageManager().reportSuccess("dyn user is : " + dyn_User.getFirstName());
IGPProcessRoleInstance roleInstance=null;
for (int i = 0; i < rolenum; i++) {
if(i==3 || i==1 || i==2){
wdComponentAPI.getMessageManager().reportSuccess("Role "+process.getRoleInfo(i).getText()+" "+process.getRoleInfo(i).getRoleName());
roleInstance = roles. createProcessRoleInstance(process.getRoleInfo(i).getRoleName());
roleInstance.addUser(dyn_User);
roles.addProcessRoleInstance(roleInstance);
}
}
IGPStructure params = null;
try {
params = GPStructureFactory.getStructure(process.getInputParameters());
if (process.getTitle().equals("Accounts Payable Process")) {
params.setAttributeValue("BarcodeID_HO2PA2TA", barcode_Id);
params.setAttributeValue("UserID_Map_HO2POTA", wdContext.nodePA_Node().getPA_NodeElementAt(wdContext.nodePA_Node().getLeadSelection()).getPA_Name_Elemenet());
params.setAttributeValue("UWL_Subject_HO2PA2TL", "Enter Details For Barcode :"+barcode_Id);
}
}catch(Exception e){
wdComponentAPI.getMessageManager().reportSuccess("Exception in Parameter Set "+e);
}
IGPProcessInstance prInstance = rtm.startProcess(process,barcode_Id,"This process has been started using the GP public API",user,null,params,user);
}
catch(Exception e){
wdComponentAPI.getMessageManager().reportSuccess("Exception Main Try Block "+e);
}
In the above code in If condition i am assigning the 3 role.
if(i==3 || i==1 || i==2){
wdComponentAPI.getMessageManager().reportSuccess("Role "+process.getRoleInfo(i).getText()+" "+process.getRoleInfo(i).getRoleName());
roleInstance = roles. createProcessRoleInstance(process.getRoleInfo(i).getRoleName());
roleInstance.addUser(dyn_User);
roles.addProcessRoleInstance(roleInstance);
}
If i assign 3 roles Exception
com.sap.caf.eu.gp.exception.api.GPEngineException: Role Action4 may not be overwritten during instantiation
If i assign Not 2 roles Exception
com.sap.caf.eu.gp.exception.api.GPEngineException: Enter a role Action4 of role type 2
I need to assign role for initiator only, not for other level.
Please tell any solution to resolve this problem....
Regards,
Sunil
Hi Sunil,
assigning users to roles from within a webdynpro-application requires setting the roles in the Guided Procedure correctly. It worked fine for me with the following configuration in the designtime environment:
Set all roles to "Instantiation defined", enable "Overwritable at Runtime", but not "Default Definition Required". I didn't set any default rules.
Hope, this might help.
Best Regards
Bettina
Message was edited by:
Bettina Hepp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hy Sunil,
if the problem is the parameter mapping in your GP - template using the context parameter UserID please take a look at the Blog
<a href="/people/berndt.woerner/blog/2007/09/19/different-ways-to-model-dynamical-assignment-of-user-to-process-roles-using-composition-tool-guided-procedures--part-1">Different ways to model "dynamically assignment of user to process roles"</a>
Hope this will help, just let me know if this fits or you need further information
Greetings Berndt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.