Skip to Content
author's profile photo Former Member
Former Member

Call workflow from Dynpro application

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 03:39 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 17, 2008 at 05:49 AM

    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());

    }

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.