cancel
Showing results for 
Search instead for 
Did you mean: 

Call workflow from Dynpro application

Former Member
0 Kudos

Hi,

I want to call workflow when i click on submit button. Please specify which function module i have to call for that . Please provide code if possible.

Regards,

Gurprit Bhatia

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I was used following FM to trigger the workflow in my customise BAPI.

call function 'SWE_EVENT_CREATE'

exporting

objtype = 'ZXXXX

objkey = object_key

event = 'CREATED'

importing

event_id = eventid

tables

event_container = event_container

exceptions

objtype_not_found = 1

others = 2.

Regards,

Eric

Answers (1)

Answers (1)

piyush_kumar6
Active Contributor
0 Kudos

hi GURPRIT ,

Use the following code to start GP work flow

from webdynpro application

IGPProcess process = null;

String message = "";

String processName = "Demo Process"; // process name given to process in GP Design Time

try {

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);

process =GPProcessFactory.getDesigntimeManager().getActiveTemplate("991EC21028BE11DD82C000144F6ABEA8",userContext); // process Id , Copy it from GP Design Time

IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();

IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();

int rolenum = process.getRoleInfoCount();

IGPProcessRoleInstance roleInstance=null;

IGPStructure params = null;

params = GPStructureFactory.getStructure(process.getInputParameters());

if (process.getTitle().equals("Demo Process"))

{

params.setAttributeValue("Attribute 1 name",Attribute 1 value);

params.setAttributeValue("Attribute 2 name",Attribute 2 value);

params.setAttributeValue("Attribute n name",Attribute n value);

params.setAttributeValue("I_ActionName_Appr","Please Approve Travel Request: "+wdContext.currentContextElement().getTripNo());

IGPProcessInstance prInstance = rtm.startProcess(process,processName,"This process has been started using the GP public API",user,roles,params,user);

}

}

catch(Exception e)

{

wdComponentAPI.getMessageManager().reportSuccess("Exception Main Try Block "+e.getMessage());

}