Trigger workflow?

Hi experts,
pls explain me how to trigger a workflow from an abap program.Which function module is used? pls give me sample code for this

Hi,
In order to trigger an event programmatically, we would use the function module SWE_EVENT_CREATE.
<b>BUS1001006 ( Standard Material )</b>
here is the sample code.
DATA: key LIKE sweinstcou-objkey.
key = '68." Material Number (hard-coded)
CALL FUNCTION 'SWE_EVENT_CREATE'
  EXPORTING
    objtype                       = 'BUS1001006'
    objkey                        = key
    event                         = 'CREATED'
  CREATOR                       = ' '
  TAKE_WORKITEM_REQUESTER       = ' '
  START_WITH_DELAY              = ' '
  START_RECFB_SYNCHRON          = ' '
  NO_COMMIT_FOR_QUEUE           = ' '
  DEBUG_FLAG                    = ' '
  NO_LOGGING                    = ' '
  IDENT                         =
IMPORTING
  EVENT_ID                      =
TABLES
  EVENT_CONTAINER               =
EXCEPTIONS
  OBJTYPE_NOT_FOUND             = 1
  OTHERS                        = 2
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
  WRITE 'Event Triggered'.
ENDIF.
COMMIT WORK.
In order to test whether the event is getting triggered or not, we can make use of Event Trace. Switch on the event trace using the transaction SWELS. 
Press ‘Switch On”. 
Now execute the program developed earlier. Now switch-off the event trace using the same transaction SWELS. 
Now go to transaction SWEL. Here you can list out the events triggered in the particular period of time. Here is the event-trace list:
Reward Points if it is Useful.
Thanks,
Manjunath MS

Similar Messages

  • How to trigger workflow for already created purchase order ?

    HELLO EXPERTS
    let me clear my scenario first . i have 1 purchase order whose workflow is not triggered . means it is showing me message no workflow that have already worked for this object.i have created 1 more purchase order taking reference of this purchase order means both are same same message for this po also. it was happening because event linkage for the business object bus2012 is not activated but now it is enabled and i have created third purchase order with reference to above po means this third po is also same as above 2 no change other than po number but for this workdflow is getting triggered . now i want to trigger workflow for orignal first po but for my first po it is showing me same message that no workflow that have already worked for this object. what i have to do to trigger workflow for this po. i have performed this steps in test system. i have workflow number

    Hello !
          You can trigger the workflow from SWUE.Enter bus2012 and created for object type and event respectively.
          Click object key button where enter the purchase order number which have been already created.
          But, why do you want to trigger the workflow again for already created purchase order ?
    Regards,
    S.Suresh

  • Trigger workflow from web form

    HI Experts,
    I have a requirement to trigger workflow when a web form  is completed through a portal and saved.I also need to perform certain validations on the fields in the web form before triggering the workflow.The web form would then go the proper approvers and then I need to send notification messages on Approval or Rejection.I am at loss of thoughts as to how I can achieve this functionality.
    I also need to send reminders to the approver every 2 hours till he takes some action.
    Any suggestions would be of great help and would be rewarded appropriately..
    Regards,
    Narsingh

    Hi Narsingh,
    the solution depends much on the web form you are implementing.
    Is this a standard portal application you are working on? Or are you developing also the form from scratch?
    The previous answers just tell how you can trigger a workflow if the application doesn't trigger it itself.
    If the web form is a standard application or built with process frameworks like HCM Processes and Forms/ISR/PCR, then the event is often published by default without any customization.
    No answers, just questions...
    Kind regards,
    Mikko

  • How can i trigger workflow from report

    hi i create one report and workflow. i want to trigger workflow from report, how can i do this one, please send me any code you have.
    Thanks & Regards
    Sankar

    Hi Sankar,
    There is another sample code...
       REPORT ZRGEVTCR.
    INCLUDE <CNTN01>.
    DATA: OBJKEY  LIKE SWEINSTCOU-OBJKEY,
          EVENTID LIKE SWEDUMEVID-EVTID.
    DATA: BEGIN OF EVENT_CONTAINER OCCURS 0.
            INCLUDE STRUCTURE SWCONT.
    DATA: END OF EVENT_CONTAINER.
    PARAMETERS:
      OBJTYPE  LIKE SWETYPECOU-OBJTYPE DEFAULT 'ZRGMARA',
      MATERIAL LIKE MARA-MATNR,
      EVENT    LIKE SWETYPECOU-EVENT   DEFAULT 'CREATED',
      VOLEH    LIKE MARA-VOLEH,
      LED      LIKE SY-DATUM           DEFAULT '19971231'.
    OBJKEY = MATERIAL.
    CLEAR EVENT_CONTAINER. REFRESH EVENT_CONTAINER.
    set input parameters for CREATED event.
    remark: to be more general, we had to use fm SWO_QUERY_PARAMETERS
    IF EVENT EQ 'CREATED'.
      SWC_SET_ELEMENT EVENT_CONTAINER 'LatestChangeDate' LED.
      SWC_SET_ELEMENT EVENT_CONTAINER 'VolumeUnit' VOLEH.
    ENDIF.
    CALL FUNCTION 'SWE_EVENT_CREATE'
         EXPORTING
              OBJTYPE           = OBJTYPE
              OBJKEY            = OBJKEY
              EVENT             = EVENT
         IMPORTING
              EVENT_ID          = EVENTID
         TABLES
              EVENT_CONTAINER   = EVENT_CONTAINER
         EXCEPTIONS
              OBJTYPE_NOT_FOUND = 1.
    IF SY-SUBRC NE 0.
      WRITE : / 'Object type', OBJTYPE, 'not found in object repository'.
    ELSE.
      IF EVENTID NE 0.
        WRITE : / 'At least one receiver was found'.
        COMMIT WORK.
      ELSE.
        WRITE : / 'No receivers found'.
      ENDIF.
    ENDIF.
    Hope this will help you to solve your problem that how to trigger workflow from the report.
    Thanks,
    Pramod

  • Deadline Monitor thru actions and trigger workflow

    I have a requirement when service ticket is created.After 5 days somesequence of process should happen through workflow.Now i have configured the start condition in Actions which should trigger workflow.
    Will there be no specific triggering  event for this workflow to trigger.As now the Action is green but no workflow is triggered.

    Hi
    in action in method you should raise event.
    this event next will trigger workflow.
    also check in tcode swetypv is you workflow connected with this event.
    Regards
    Radek

  • How can i trigger workflow when particular event happens in webdynpro

    how can i trigger workflow when particular event happens in webdynpro

    hi,
    To trigger workflow , use the fm : 'SAP_WAPI_START_WORKFLOW'
    Refer this thread for similar requirment : Workflow in WebDynpro
    Blog : http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417500)ID1564403950DB00699140435432809306End?blog=/pub/wlg/2778

  • We have three discussions forums with same subject. whenever a post gets new reply in one forum, it should automatically trigger workflow functionality to check conditions and send the same reply to other synchronized forums.

    we have three discussions forums with same subject. whenever a post gets new reply in one forum, it should automatically trigger workflow functionality to check conditions and send the same reply to other synchronized forums.
    Rajiv Kumar

    Hi,
    More details about your discussions forum will make others easier to find a corresponding solution on your requirement.
    If you mean there are three Discussion Board list waiting for synchronizing, I would suggest you create an Event Receiver for the three Discussion Board list.
    Here is a link with code demo about how to copy items from one Discussion Board to another including Replies:
    http://spcodes.blogspot.com/2013/03/programmatically-copy-items-from-one.html
    Here is a step by step sample on creating a simple Item added event receiver for Custom List in SharePoint 2010:
    http://msdn.microsoft.com/en-us/library/ff398052.aspx
    More information on Event Receiver for your reference:
    http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx
    http://msdn.microsoft.com/en-us/library/ff408183(v=office.14).aspx
    Feel free to reply if there are still any questions. 
    Best regards
    Patrick Liang
    TechNet Community Support

  • Trigger workflow from adobe form

    Hi.. can anyone outline me with the basic steps required to trigger workflow from abobe. Java Wd and ECC 5.0. Thanks!

    Hi Pankaj,
    have a look at the ISR Cook book and Developing PCR (Personal Change Requests) <a href="https://websmp202.sap-ag.de/mss">Manager Self Service</a> You will gwet more links if you do a quick search or just go to sdn.sap.com/interactive forms
    <a href="https://forums.sdn.sap.com/click.jspa?searchID=2077779&messageID=2451183">https://forums.sdn.sap.com/click.jspa?searchID=2077779&messageID=2451183</a>
    Do update, if you find any more issues
    Thanks and Regards,
    Anto

  • Std Bapis which can trigger Workflows inHR

    Hi friends,
    Do we have any std Bapis which can trigger workflows in HR module.
    The functionality I am looking at is Intra country promotion/transfer.
    Please suggest.
    Cheers,
    Rajesh.

    Hi,
    I do not know your knowledge of SAP Workflow. So maybe you should start with standard [SAP documentation|http://help.sap.com/saphelp_nw04/helpdata/en/8d/25f90a454311d189430000e829fbbd/frameset.htm]. Especially check section Using Events. I really enjoyed book [Practical Workflow for SAP|http://www.sappress.com/product.cfm?account=&product=H950].
    What's the name of the workflow you want to start?
    Cheers

  • SRM -  Fields to Trigger Workflow in PO

    Hi all,
    I've an requirement it's similar to  SPRO-->  SRM server --> sourcing--> Define Fields in Shopping Cart Which Trigger Workflow
    I can define which fields in a shopping cart should trigger an approval workflow when they are edited. But  don't in Purchasing Order.
    I'm not sure if it is possible in PO . If yes, any suggestions on how to go about this for PO.
    thanks,
    Edward.

    Satya,
    Abap client proxy refer these
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    Concepts and examples for Proxy, Abap Client Proxy and Abap server Proxy
    This thread has lot of links to workflow
    XI certification Questions
    Message was edited by:
            Anusha  Ramsiva

  • Trigger workflow from Email (lotus or Outlook)

    Hi All,
    Is it possible to trigger a workflow from An Email (lotus or Outlook). if so how can we do it?
    Reg,
    Sre
    Edited by: sre on Jul 9, 2009 3:53 PM

    Check the following links.. which answers its pretty much possible to Trigger workflow from email...
    triggering workflow from incoming mail.
    Triggering a workflow on receiving mail from external mail id.
    Can we trigger workflow on receiving e-mail ?
    Regards,
    PR.

  • Create event in GOS obj to trigger workflow while attaching data with GOS

    Hello experts,
    It is a little bit urgent.
    I have a scenario. We have to attach documents to SAP application using GOS. These documents can be edited also.
    Now second part is that when we attach the document or edit the document, the document should be send with the work item "when we attach the document".
    The first part of the scenario is completed and working fine. The second part of the scenario is causing problem. I have checked the various options but none of them are proving helpful.
    There is an option in GOS toolbar to send the documents through workflow but that also asks for the related workflow.
    I was trying to create an event for GOS object (Z object not a subtype of any other object) which can trigger the workflow automatically when the attachment are created and edited but can not go further with it as am not so strong in workflow. I ahve just created the event. Do I need to write some code for the event?
    I request you to kindly help me either in creating this event which will trigger the workflow (whole process) or any other method to do the same.
    Thank you all in advance.

    Hello Arghadip,
    Thank you for replying so early. The table point is very helpful but about the batch job I do not get it. I think the second option is good trigerring event on updation of table. But again I do not know how to do it as I have customized object so have to create the event from the scratch and that, sir, is my main problem.
    Kindly help.
    Thank you

  • Change line item in PR, PO, Sch agreement, contract to trigger workflow.

    Hi.
    The requirement is whenever there is a change in a line item. The workflow is to trigger. When I use the events:
    SIGNIFICANLYCHANGED IN BUS2009
    CHANGED IN BUS2012 (ENTRY MAINTAINED IN SWEC)
    Z_CHANGE IN BUS2013 (ENTRY MAINTAINED IN SWEC)
    CHANGED IN BUS2014 (ENTRY MAINTAINED IN SWEC)
    The problem with the above events is that, right after the event "RELEASESTEPCREATED" the above events get triggered automatically. My requirement is that, it should get triggered only on line item changes (new version of the purchasing document is created).
    Thanks and expecting a reply soon..
    Sukumar.

    Hi Vinoth,
    I did the same thing but a bit differently.
    i used the code as below.
    DATA: container like table of swr_cont with header line, xeban like table of  ueban with header line, xebkn like table of uebkn with header line, yeban like table of  ueban with header line, yebkn like table of  uebkn with header line, object_key type swr_struct-object_key, item_numc type numc05.
    select * into corresponding fields of table xeban from eban where banfn = number and bnfpo = item.
    select * into corresponding fields of table xebkn from ebkn where banfn = number and bnfpo = item.
    yeban = xeban.
    yebkn = xebkn.
    read table xeban index 1.
    xeban-kz = 'U'.
    xeban-banpr = '08'.
    modify xeban index 1.
    CALL FUNCTION 'ME_UPDATE_REQUISITION'
    TABLES
    xeban = xeban
    xebkn = xebkn
    yeban = yeban
    yebkn = yebkn.
    This solved the issue as far as PR is concerned. I need to update PROCSTAT in EKKO for PO, scheduling agreements and contracts.
    Let me know about this.
    Thanks,
    Sukumar.

  • How to trigger workflow from changes in Sales Order in CRM?

    Hi Experts,
    I want to trigger event at the time of saving the changes in sales order (TCODE- CRMD_ORDER).
    I have found one BO - BUS2000115 but it is getting triggered only after new creation of sales order.And there is no BO available when we change the sales order.For this reason I have created one customize event in BO(BUS2000115).
    Now my question is How should I link this customize event so that it will trigger after saving the changes ?
    I have seen SWEC transaction but was not able to find anything to link this customize event.
    Please help ....!!!
    Good response will be rewarded.
    Thanks
    Snehasish Das
    Edited by: Snehasish Das on Feb 14, 2008 2:31 PM

    In SWEC, actually you link the change document object to a Business object and its corresponding event , to which workflow should react to.
    If yo udo not find the entry then, yo unedd to create one with finding out the respective chage documnet object.
    Hope that helps.
    Regds,
    Akshay

  • Creation of change document to trigger workflow.

    Hi,
    I need to trigger a workflow when there is a change in the PO line item (EKPO). For this, I can use the standard change object EINKBELEG, but this only bears the purchasing document number as the key. hence when ever a change event is triggered in the custom BO, the key is just the PO#. This should be not the case.
    The key field should be a combination of the purchasing document number and the line item number, hence I created a custom change object ZEINKBELEG refering to EKPO and generated it too. The steps in SCDO, SWED, SWEC has already been handled. But the custom event in the business object does not get triggered. I need some help regarding this.
    Precisely speaking, if there is a change in the line item value (in ME22N). The business object event should trigger.
    Thanks,
    Sukumar.

    Hey Sukumar,
    Do one thing  instead of creating  custom change document. create a new  event in bus2012 using condition editor of SWEC only create a event only when there is a change in EKPO. that resolves your issue..  just a suggestion

  • Trigger Workflow on basis of PR Type

    Hi All,
    I want to trigger 2 workflows on the basis of 2 PR Types.
    I am using BO 'BUS2105' and event 'RELEASESTEPCREATED' to trigger my workflow.
    But now how can I put the start condition that if PR TYpe = 'N', only then trigger the workflow.
    I know how to put start conditions using Start Condition tab or using Check FM but I am not getting exactly expression which should be used for my case.
    Please help.

    Hi,
    In this case using the Object Key (Purchase Requisition number) you need to get the PRTYP using the SELECT statement and raise the exception if you they are not equal to your values.
    You need to write this logic in the check FM. Please let me know the Field name and in which table this field is present so I may be able to provide you more information.
    Regards,
    SRinivas.

Maybe you are looking for