Triggering workflow programatically

I want to trigger workflow programatically by using sap_wapi_workflow_start fn module  i have given task no : ws99900015 like this  in workflow template -start events tab is there any need to mention any thing
any one please suggest me

Hi TCS Team,
                      Better use start simple Function Module this one will we very simple and you can also pass values in to the container.
As in this example the passing container is wi_container the same container will be created in Workflow template.
*& Report  ZTESTPDS01
REPORT  ztestpds01.
INCLUDE <cntn01>.
SWC_CONTAINER WI_CONTAINER.
SWC_CREATE_CONTAINER WI_CONTAINER.
data: AGENTS  LIKE SWHACTOR OCCURS 0 WITH HEADER LINE,
      v_kunnr like kna1-kunnr.
DATA: WA_KNA1R LIKE KNA1.
DATA: it_kna1 LIKE table of wa_kna1r with header line.
v_kunnr = '0000000001'.
select * from kna1
         into table it_kna1
         where kunnr = v_kunnr.
LOOP AT IT_KNA1.
MOVE IT_KNA1 TO WA_KNA1R.
ENDLOOP.
SWC_SET_ELEMENT WI_CONTAINER 'testPDS' WA_KNA1R.
SWC_CONTAINER_TO_PERSISTENT WI_CONTAINER.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
  EXPORTING
   CREATOR                            = 'DHEEPAKS'
  PRIORITY                           = SWFCO_NO_PRIO
    task                               = 'WS99900015'
  CALLED_IN_BACKGROUND               = ' '
  DEADLINE_DATA                      = ' '
  NO_DEADLINE_PARAMETERS             = ' '
IMPORTING
  WI_ID                              =
  WI_HEADER                          =
  RETURN                             =
  WI_RESULT                          =
  SWF_RETURN                         =
  tables
    agents                             = agents
  DEADLINE_AGENTS                    =
  DESIRED_END_AGENTS                 =
  LATEST_START_AGENTS                =
  EXCLUDED_AGENTS                    =
  NOTIFICATION_AGENTS                =
  SECONDARY_METHODS                  =
   WI_CONTAINER                       = wi_container.
CHANGING
  WI_CONTAINER_HANDLE                =
EXCEPTIONS
  ID_NOT_CREATED                     = 1
  READ_FAILED                        = 2
  IMMEDIATE_START_NOT_POSSIBLE       = 3
  EXECUTION_FAILED                   = 4
  INVALID_STATUS                     = 5
  OTHERS                             = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ENDIF.
Regards,
dheepak

Similar Messages

  • FM or include that triggers Workflow in sap SRM 5.0.

    Hi All,
    Can anyone tell me the FM, for triggering a workflow in SAP SRM 5.0. I mean the name of the program or Include or an FM which finally triggers workflow while saving?
    Thanks,
    Edited by: Manoj Singh on Oct 6, 2011 6:51 PM

    Hi Gaurav,
    Thanks for responding. Yes, all the backend config are in place since I am able to successfully run an equivalent RFC (BBP_PD_SC_GETLIST) and another RFC named BBP_PD_SC_GETDETAIL from SE37. The problem seems to be something very specific to the ES. May I request you to run this ES at your end (if possible) and let me know the result possibly with the input and output message similar to the one I pasted in the origincal question.
    Thanks in advance,
    Nilay

  • How to update agent list after triggering workflow?

    Hi Guys,
               Is there any function module to update the agent list after triggering the workflow? i mean after triggering workflow, the user is maintaining some approving officers in their table and they are expecting the workflow should route the workitem to  those newly maintained approving officers. So can any one help me to solve this issue.
    Regards,
    Safiq

    if any agent maintained in the customized table, how can I update
    those agent with existing available agent list.
    It sounds like updating the existing workitem container with the new updated values. right? You mean to say initially workflow is triggered and the agent list is populated in the workflow container. But after the workflow is triggered if the table is updated with some new entries, then these new entries must alos be included in the agent list container element in the workflow container.
    If this is the case the you have to modify the multiline container element of the workitem container. You can make use of the standard function module SAP_WAPI_WRITE_CONTAINER but this function module needs to be called each time when evenr a new entry is created and you have to check what are all the workitems that you want to update ,
    I think its a bit difficult to update all the workitems which are with reagrd to this scenario.. so you have to check out some other simple way. But on a whole what I can say is you can update an existing workitem container by using the FM mentioned above...

  • How to add new attribute for triggering workflow?

    Dear Expert,
    I want to create condition for triggering workflow.
    I am working on travel request workflow, using BUS2089.
    my requirement is to differentiate or make condition of triggering workflow based on trip activity type,
    but I can't find any attribute about trip activity type.
    how to add activity type to be available for create condition?
    thanks

    Hi,
      If am not wrong you are trying to raise event when ever there is a new travel request raised, so the BOR would be availbel in the workflow container to be more preciese it would be available in the event container, so you need to find out the right attribute in the BOR where the trip type is assigned and validate this in the start conditions i mean in the basic data of the workflow where you activate the event linkage.
    Regards
    Pavan

  • Details for triggering workflow on changing material

    Hi Experts ,
    I am triggering workflow BUS1001006 for creating/changing material .
    Is it possible to get the details that has been changed in the material using this ?
    Is there any other way to get the fields changed in MM02 for a material through
    workflow ?

    Hi
    Check the business object all the attributes in the log. If you get its fine if not create an attribute write your logic in that for changed material.
    Regards
    vijay

  • Invoking WLPI workflows programatically

    I am looking for documentation for invoking a WLPI workflow
    programatically with my own code. I have set up the workflow & can
    activate and start the workflow using the worklist application provided
    by BEA but cannot find any documentation to suggest how I can do this
    myself.
    I see the com.bea.wlpi.server.admin.Admin object which lets me get
    templates, get template definitions, get business operations, etc. I
    also found the com.bea.wlpi.server.worklist.Worklist object which gets
    me the startable workflows, tasks etc. I can execute tasks from the
    worklist object, but then I would have to execute and mark the tasks
    (which in effect would make my code be the workflow engine). What I'd
    like to do is grab a workflow template definition and run the workflow.
    Something like:
    Object result = ctx.lookup("com.bea.wlpi.Worklist");
    WorklistHome wfHome = (WorklistHome) PortableRemoteObject.narrow(result,
    Class.forName("com.bea.wlpi.server.worklist.WorklistHome"));
    Worklist worklist = wfHome.create();
    List workflows = worklist.getStartableWorkflows(organization);
    for (int i=0;i<workflows.size();i++) {
    /* something to kick each one off here */
    Any suggestions greatly appreciated.
    Also BEA, how about that WLPI newsgroup ?

    Finally got it to work for manual workflows. Here's what it took:
    1)Grab the worklist object using the JNDI/EJB code below
    2)Use worklist.instantiateWorkflow() and parse out the result to get the
    workflow instance id and the template definition id (for setting workflow
    variables)
    3) If necessary, find the first task in the workflow using
    Admin.getInstanceTask() and execute it.
    Also I ran into the problem where my sample workflow was taking off before I
    passed it my workflow variables. To get around this, I made the first task
    in my workflow do nothing when activated, and only do work when executed.
    That way I could instantiate the workflow and call
    Admin.setInstanceVariable() to set the variables. Only then did I grab the
    first task in the workflow and execute it.
    It would be nice if you could call worklist.instantiateWorkflow() with some
    extra args that could provide workflow variables to the workflow engine.
    Brian Hall wrote:
    I am looking for documentation for invoking a WLPI workflow
    programatically with my own code. I have set up the workflow & can
    activate and start the workflow using the worklist application provided
    by BEA but cannot find any documentation to suggest how I can do this
    myself.
    I see the com.bea.wlpi.server.admin.Admin object which lets me get
    templates, get template definitions, get business operations, etc. I
    also found the com.bea.wlpi.server.worklist.Worklist object which gets
    me the startable workflows, tasks etc. I can execute tasks from the
    worklist object, but then I would have to execute and mark the tasks
    (which in effect would make my code be the workflow engine). What I'd
    like to do is grab a workflow template definition and run the workflow.
    Something like:
    Object result = ctx.lookup("com.bea.wlpi.Worklist");
    WorklistHome wfHome = (WorklistHome) PortableRemoteObject.narrow(result,
    Class.forName("com.bea.wlpi.server.worklist.WorklistHome"));
    Worklist worklist = wfHome.create();
    List workflows = worklist.getStartableWorkflows(organization);
    for (int i=0;i<workflows.size();i++) {
    /* something to kick each one off here */
    Any suggestions greatly appreciated.
    Also BEA, how about that WLPI newsgroup ?

  • Triggering workflow using user-exits

    Hi all,
    can anyone tel me how a workflow can be triggered using user-exits??
    thanks in advance

    Call function module SAP_WAPI_CREATE_EVENT (with COMMIT_WORK = space) to create an event, and use the event to start your workflow (triggering event). Alternatively, you can start the workflow directly using the corresponding SAP_WAPI function module for that purpose. My recommendation is that you normally don't start workflows directly as it is a less flexible solution (or you have to build that flexibility yourself instead of using what you get for free with triggering events).
    However, why are you asking this question? I started wondering after seeing you ask an almost identical question in [another thread|Triggering Workflow Using BADI; here.

  • Event not triggering workflow always

    Hi,
    I have a parallel approval workflow which I trigger everytime I receive a decision from a UWL.it works fine but in some cases all the decisions are not received by the workflow.
    Steps: I receive the decision from UWL via a RFC
               I trigger the workflow with the decision using SAP_WAPI_EVENT_CREATE.
               However sometimes out of 5 decisions only 4 reaches and the workflow never completes since I wait till all the decisions  are received.
    After triggering the event I also update a table which shows correct values meaning the data is correctly passed from UWL.
    Not sure what can be the cause. Anyone any ideas.
    Thanks
    Papiya

    Hello,
    Either the event isn't being created, or the event is being created ad the workflow isn't triggering.
    Check tx SWEL (event trace, turn on with SWELS) to see if SAP_WAPI_CREATE_EVENT is creating the events.
    It will also show you if a workflow is triggered, and what the workitem id is. It will also show any errors.
    regards
    Rick Bakker
    Hanabi Technology

  • RFC issue in Triggering workflow

    Hi,
    I am trying to trigger a custom workflow from EP in Newly set up ECC 6.0 system.
    Problem here is, Business object Event is getting triggered in R/3 with custom workflow as reciever, but the workflow is not going to the first stepThe event trace (SWEL) gives following information,
    Action                   Receiver started correctly
    RFC Status           Logon not possible (error in license check)
    I have checked the configuration in SWU3, all where fine, also the RFC WORKFLOW_LOCAL_100 tested successfully. The ECC6.0 has the full license.
    Please let me know why this has happened? How can it be solved? Please reply ASAP.
    Thanks,
    Shrinivas

    Hi,
    WF-BATCH has validity till 12/31/9999 and also the workflow initiator has SAP_ALL authorization,
    Still the issue has not been solved. New thing i noticed this this problem happens intermittently !
    For some time it is working fine, some other time its giving the same RFC error.
    Thanks,
    Shrinivas

  • GRC 10 HR Triggers Workflow

    Hello Experts,
    I have cconfigured HR Triggers for change of position using Procedural call method. Created BRF+ Rule that identifies the condition and returns ACTION-ID. I can see that condition is satisfied when change of Position occurs, but it not following any workflow.
    Where do we link the ACTION-ID to a workflow? Do we need to create new initiator with BRF+ Function ID ?
    Already followed note 1591291 but did not help.
    Thanks and Regards,
    Ajesh.
    Edited by: Ajesh Raju Pujari on Mar 4, 2012 2:56 PM

    Hi all, 
    check the transavtion SLG1 run it backend system mention the following
    Object: GRAC
    Subobject:HRTRIGGER 
    External ID: *
    then mention the dates and make * in remaning fileds  for log class select All Logs  and Log Creation ANy
    Log Source Formatting select the first option then run the report
    select the date which Hire actiivity taken place and Double click on it
    you will get the log report and the exact error issue
    Normally you define the workflow in SPRO as i nthe following the path 
    SPRO ->GRC -> Access Control ->  Maintain mAC Application anf BRF+Fucntion mapping
    maintain the workflow name 
    then you need to map the workflow in the MSMP  GOto GRC->AC->workflow for access control -> Maintain MSMP workflow - select the standerd workflow you mentioned then go to the stage Maintain Path and maintain the path mentioned then go to stage Maintain Route Mapping and RUle ID for HR Trigger and PAth ID 
    hope it you solve 

  • Held PO triggering workflow and agent assignment to myself

    Hi experts,
    Is there a way where I can prevent held documents from triggering my workflow?
    How can I achieve the following 2 scenarios for agent assignment:
    1) Create PO and workitem route back to myself
    2) Release PO and workitem route back to myself

    Lester,
    If you are a User01, then You started the process like if you are creating the PO, then the workflow is getting triggered. So now you are the initiator of the process, and in WF_inititor will be hold your user name user01.
    Thanks,
    Vijay.

  • When we will go to triggering events programatically and when throgh tab?

    hi experts........
    i am new to work flow can any one tell me that when we will trgger events programatically and when we will trigger through by events tab, what is differnce between them?
    i searce in sdn/google but exactly i didnot get the answer?
    thanks in advance

    Sorry but forum is not for basic training, as you are asking "what are workflow events". Moreover, you should post (more elaborate questions) to workflow forum

  • Triggers workflow from badi

    In crm 2007 two installed bases are there. one is customer ibase  and the other is company ibase   when the customer wants to transfer the component from company ibase to customer ibase(he simply drags  the component from company ibase to his ibase) that needs to go for approval process. no event is triggering at this point. after he press save button 3 badis are triggering, i found one badi which suits me  the problem is i will trigger workflow from badi if  that approver approves that component should be saved in companys ibase if approver rejects that should not save   anyone please guide me how to handle  this ....

    Hi Sunil,
    To achieve this functionality, in t-code SE18 create a BADI implementation and add a function module call to SAP_WAPI_CREATE_EVENT. Trigger any BO event and associate the same event as the triggering event  of your workflow.
    Please note that direct workflow call is not an optimum approach so use BO events.
    Create a workflow using t-code SWDD. Add a 'User Decision' step to send workflow task to the approver.
    Add two branches in it one for 'Approve' other for 'Reject'. In the approve branch add the logic for saving the component in company ibase.
    Hope this helps!
    Regards,
    Saumya

  • Triggering workflow using error messages

    hi all,
    how can i trigger workflow from error messages?
    thanks in advance

    If this is a custom Error message put your code for triggering your Workflow just after that. Use FM SWE_EVENT_CREATE or SAP_WAPI_START_WORKFLOW.
    If it is a Standard message used in SAP Programs then look for User Exit.

  • Triggering workflow through MIGO in output type

    Hi Friends,
                  After the GR Documents are posted, I need to Trigger GR  Workflow......
    Please guide me any Function modules or BAIDs
    to keep our code once the MKPF and MSEG DB Tables are updated with recently Created new Documents....
    Can we Assign our Workflow Template in the OUTPUT Type in NACE.
    If so, Please Guide me with the OUTPUT Type configuration Steps
    Thanks in Advance,
    Ganesh

    I think you can use standard Buiness object BUS2017. While creating the document please check which events gets trggered in SWEL. I am sure the Created event of this Business object gets triggered.
    Thnaks
    Arghadip

Maybe you are looking for

  • Getting error 3001 when using Excel Easy Table.vi

    When making a call to Excel Easy Table.vi (Report Generation Toolkit) I get a 3001 error. I have attached an example VI to demonstrate the problem.  Please run "Add Table Example.vi" in the attached zip.  This sample program is made up of VIs from a

  • How to enable the filetransfer in Oracle Communicator 11g?

    Hi, I've already change the relevant values in the Program Files\Oracle\Oracle Communicator\defaults.xml as following:      <FileTransfer>           <Location>http://example.com:7001/filetransfer</Location>      </FileTransfer>      <FileTransferEnab

  • Isolation_level-TRANSACTION_READ_COMMITTED_FOR_UPDATE

              Im using BEA Weblogic 7.0 server and Oracle 9.0.1 DB .           I got below Exception when using the Isolationlevel           as TRANSACTION_READ_COMMITTED_FOR_UPDATE.           when tried using both Weblogic JDBC driver and Oracle JDBC (o

  • Excise Table Entry

    Hi Friends 1) While we do excise JV through J1IH does it make the part 2 entry in excise table ? If so than in which table? 2) In which table RG23A part1 &part 2 entries registered, while we do PGI & PGR for raw material? 3) In which table RG23C part

  • USING FACETIME ON INTEL IMAC

    DOES FACETIME WORK ON AN INTEL IMAC?