Terminating Event for BUS2017 Custom Method

Dear Experts,
I have an issue with the Terminating Event of the Workflow for BO : BUS2017. The event is getting triggered but receiver is not being picked.
I have created two events GR_103 and POST_105 in the Custom BO ZBUS2017 by delegating it to BUS2017. GR_103 is the triggering event for my workflow which I have triggered in the POST_DOCUMENT Method of the Implmentation for BADI : MB_MIGO_BADI.
GR_103 is triggered while doing MIGO (Goods Receipt) for Movement Type 103. My Workflow is triggered perfectly and then I have used a Dialog Asynchronous Task in which I have called the MIGO Transaction for Releasing the GR Blokced Stock using the Movement Type 105. I have created a Custom Method POST in the BO ZBUS2017 and I have used the FM: MIGO_DIALOG to call the MIGO. I am trying to raise the POST_105 event in the Method MB_DOCUMENT_BEFORE_UPDATE of the Interface IF_EX_MB_DOCUMENT_BADI.  I have defined the Terminating Event for the asynchronous Task as POST_105.
Now the event POST_105 is triggered, but SWEL says 'No receiver entered'. Even the SWEINST shows the object data as the current Work Item along with Object Key, but still receiver not picked. When I try to trigger the same event in a test report by using call transaction, then the event triggers and work item gets completed without any issues.
Please advise.
Below is my terminating event code.
  READ TABLE xmseg INTO wa_mseg INDEX 1.
  CONCATENATE wa_mseg-mblnr wa_mseg-mjahr INTO l_objkey.
  IF wa_mseg-bwart = '105' .
    CALL FUNCTION 'SWE_EVENT_CREATE'
      EXPORTING
        objtype           = 'BUS2017'
        objkey            = l_objkey
        event             = 'POST_105'
      EXCEPTIONS
        objtype_not_found = 1
        OTHERS            = 2.
  ENDIF.
Regards,
Raju.

Have a COMMIT WORK after the function call. (At least test it - I am not sure if it will have some effects in your BADI - at least you will know whether the issue is about missing commit).
And please use SAP_WAPI_CREATE_EVENT instead of the old function you are using.
Also, make sure that the events will look exactly the same in event monitor SWEL when triggered from your code and when using test tool. Maybe there is some minor difference/mistake (object key, etc.) that you haven't noticed.
Regards,
Karri
Edited by: Karri Kemppi on Feb 7, 2012 8:14 AM

Similar Messages

  • How to raise a Terminating Event for a Standard Task?

    Hi Experts,
    I have a standard task where I have defined the Terminating event to stop the workflow.
    This Task/Workflow will be triggered by a batch program.
    Also in a class method I am using function module SWE_EVENT_CREATE to raise a event which should complete the workflow.  But somehow the work items are still in In Process status.
    May be I am passing wrong parameters OR using wrong FM to raise a terminating event.
    Request you to help me on this.  Thanks in Advance.
    Regards,
    Sudhakar.

    Hi Sudhakar,
    Since there are entries in SWE3 which show link each time event is triggered. So I would suggest you will have to check the standard task you are using is working. So create a parallel branch with activity on one end and wait for event step on other. See if the the wait for event step works, when you create the event using create event. If it works then most likely your task binding has a problem. If not then event that is triggered does not getting picked by workflow. So based on the finding we can find a solution.
    I notice that you are calling the event from an ABAP class, so in that case the code for calling event seems to be different. Check out the below SAP help documentation.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/a1/172437130e0d09e10000009b38f839/frameset.htm
    Regards,
    Kartik N.
    Edited by: KARTIK Nayak on Dec 12, 2008 8:25 PM

  • Regarding creation event in user exit for create customer

    hi gurus,
    in user exit how to create event for create customer
    regards
    vijay

    Hi
    Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
    1) Goto se24 (Display class cl_exithandler)
    2) Double click on the method GET_INSTANCE.
    3) Put a break point at Line no.25 (CASE sy-subrc).
    Now
    4) Execute SAP standard transaction
    5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
    6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
    7) This way you will find all the BADIs called on click of any button in any transaction.
    mark if helpful
    Regs,
    Tushar Mundlik

  • Custom UIView not receiving touch events for fast mouse clicks in simulator

    I'm having a problem in the simulator where if I click fast in a UIView inside a table cell that is setup to receive touch events, it doesn't receive them. But if I click slow (holding down the button for a little bit) the view gets the touch events. I can't test it on the device. Is this a known problem in the simulator?
    Thanks.

    Hi George,
    Thanks a lot for your quick response and jumping to help.
    I am so frustrated that I did not get touch event for the custom cell.
    I also tried your solution for a custom UIImageView, I put the codes of PhotoView.h, PhotoView.m and TestTouchAppDelegate.m here: Please help to look into it for me.
    // PhotoView.h
    // Molinker
    // Created by Victor on 6/18/08.
    // Copyright 2008 _MyCompanyName_. All rights reserved.
    #import <UIKit/UIKit.h>
    @interface PhotoView : UIImageView {
    CGPoint touchPoint1;
    CGPoint touchPoint2;
    @property (nonatomic) CGPoint touchPoint1;
    @property (nonatomic) CGPoint touchPoint2;
    @end
    // PhotoView.m
    // Molinker
    // Created by Victor on 6/18/08.
    // Copyright 2008 _MyCompanyName_. All rights reserved.
    #import "PhotoView.h"
    @implementation PhotoView
    @synthesize touchPoint1;
    @synthesize touchPoint2;
    - (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
    // Initialization code
    self.userInteractionEnabled = YES;
    return self;
    - (void)drawRect:(CGRect)rect {
    // Drawing code
    // Handles the start of a touch
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    UITouch *touch = [touches anyObject];
    touchPoint1 = [touch locationInView:self];
    // Handles the end of a touch event.
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    UITouch *touch = [touches anyObject];
    touchPoint2 = [touch locationInView:self];
    if(touchPoint1.x>touchPoint2.x)
    //move Left
    NSLog(@"Move Left");
    if(touchPoint1.x<touchPoint2.x)
    //move Right
    NSLog(@"Move Right");
    - (void)dealloc {
    [super dealloc];
    @end
    // TestTouchAppDelegate.m
    // TestTouch
    // Created by Victor on 6/17/08.
    // Copyright _MyCompanyName_ 2008. All rights reserved.
    #import "TestTouchAppDelegate.h"
    #import "RootViewController.h"
    #import "PhotoView.h"
    @implementation TestTouchAppDelegate
    @synthesize window;
    @synthesize navigationController;
    - (id)init {
    if (self = [super init]) {
    return self;
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Configure and show the window
    //[window addSubview:[navigationController view]];
    UIImage *myImage= [UIImage imageNamed: @"scene1.jpg"];
    CGRect frame = CGRectMake (0, 20, 300, 400);
    PhotoView *myImageView1 = [[UIImageView alloc ] initWithFrame:frame];
    myImageView1.userInteractionEnabled = YES;
    myImageView1.image = myImage;
    [window addSubview:myImageView1];
    [window makeKeyAndVisible];
    - (void)applicationWillTerminate:(UIApplication *)application {
    // Save data if appropriate
    - (void)dealloc {
    [navigationController release];
    [window release];
    [super dealloc];
    @end
    Message was edited by: Victor Zhang

  • Terminating Event Not Triggering

    HI Guys,
                   I have added a custom task to call MRBR screen and set a Terminating Event for this task. It is a Asynch Method.
    Through SAP_WAPI_CREATE_EVENT i am calling the terminating event but my task is not getting terminated.
    I checked in SWEL i could see evnt log for my terminating event without Receiver type.
    Kindly help me to sort out this issue.
    Regards,
    Dheepak

    Hi
    Where have you written the code for triggering the termination event?
    Also in your task have you created an entry:
    WIOBJECT_ID   FIPP  TerminatingEvent Name.
    When everything is done properly in SWEL you would see the receiver as workitem.
    Thanks and Regards
    Aman

  • Terminating event and abap oo class

    Hi, gurus,
    I 'd like to know how the terminating event works.
    for example,  i define a custom abap oo class (which has been implemented the interface of IF_WORKFLOW), and i want to use it as the terminating event of a standard task.
    could you please tell me how does it works?
    1. there must be an instance defined in the container of the task?
       which must be instanciated in the run time?
    2. then in another abap report, i simply raise the event defined as the terminating event, using the same key, then the pending task will be terminated?
    could you pls provide more information on this ?
    thanks and best regards.
    Jun

    Hi Jun Zhang,
    An event that is used to stop a workflow or task, or change the behavior of an already started workflow is called Terminating Event.
    If the event linkage is active and the linkage rules are satisfied, the status of the work item is set to COMPLETED.
    Defining Event Linkage  Terminating event linkage consists of 2 parts.
    Type linkage which specifies business object type, event name, generic name for event receiver (WORKITEM for terminating events of tasks or EVENTITEM for wait for event steps)
    Instance linkage which identifies the particular receivers (I.e. work item Ids) per object instance.
    Terminating event linkages can be seen in SWE3.
    For terminating events, along with Business object and Event a Container Element should be specified that holds the Object Instance.
    Terminating Event for Workflow is available from Release 6.10 only. This is defined in Basic Data of Workflow Builder.
    Binding Definition is optional for Terminating Events. Binding can be defined b/n event container and workflow container to pass event information to the workflow if required. That is the only way of passing information from an asynchronous method to the task that started it.
    Thanks and Regards,
    Prabhakar Dharmala

  • ECC6.0 WebDynpro(ABAP) - raising terminating event

    Hi, in ECC6.0 I have a custom WDA application with a custom workflow.  The workflow is launched via an event that is raised in the WDA application.  However, at one point workflow sends a link to one of the WDA pages, whereby the user clicks a button which raises what should be a terminating event for the workflow task.  However, while this event is raised, as confirmed in SWEL, it doesn't terminate the task.  The event is raised through a WDA assistance class.  The object type, event and object key are all being set properly during the raising of the event.  Viewing the event in SWEL confirms the proper setting of the key fields.  So why isn't the step terminating?
    Thanks in advance,
    Kevin

    Hi,
    If the object that is waiting for event has no instance, the task will not be terminated when the event is created in the system (As I said). So now the reason is clear for you.
    >The event is raised through a WDA assistance class
    I am not sure what you mean by this. You raise the event from the WDA assistance class? Or you raise an event for the assistance class? (Or perhaps both?).
    If you raise the event for the assistance class, you should have an instance of that class in the workflow container (which you would then bind from workflow container to the task container). So, now the question is: do you have an instance of the assistance class in the WF container (when you look it from log)? Or is it initial also?
    Actually I don't really even understand how you have managed to combine the WDA assistance class and WF class? How do you actually start the workflow (with which kind of event)? Whatever event it is, it should most likely instantiate some class/object in the workflow. Then in your problematic task you should most likely use this same class in the terminating event (unless there is something really fancy in your workflow).
    Regards,
    Karri

  • Read workitem Container Value in Terminating event Check Function Module

    Hi
    I have some problems reading work item data / values of a work item container element in a check function module on a terminating event – Do any of you know if this is possible, and if so, how it’s done ?
    In My scenario I have created a multiline approval step for my business document, one task pr Line Owner.  The Event Approved is defined as a terminating event for this task, and the line owner is passed to the task container.
    Now, when I raise the event, with the line owner as an event parameter, I would like to check if the line owner on the raised event, matches the line owner in the task container in question in a check fm. But here I faced the problem, that only event data, and not work item data, are passed to the Check Function module.
    Regards,
    Morten Nielsen

    Hello Morten, hello Arghadip,
    in the instance linkage's check function module (entered via transaction SWEINST) you'll have the workitem-id in the system event parameter EVTRECEIVER_ID
    With this number you can use the frame work in order to read the work item container.
    This is a sample coding, how you access the correct work item container using SAP Enterprise and it's new OO frame work, which checks on the terminating event of BUS2105.Released the correct release code for a work item.
    INCLUDE <cntn01>.
    INCLUDE <SWFCNTN01>.
    INCLUDE RSWEINCL.
    *** Read workitem instance and container from event
           DATA: wi_id            TYPE swwwihead-wi_id.
           swc_get_element EVENT_CONTAINER evt_receiver_id wi_id.
           IF sy-subrc <> 0.
              MESSAGE E015(ZPREL) WITH evt_receiver_id
                                           RAISING wrong_call.
           ENDIF.
           DATA: lv_wi_handle    TYPE REF TO if_swf_run_wim_internal.
           DATA: ls_context      TYPE sww_wimctx.
           DATA: lv_wi_container TYPE REF TO if_swf_cnt_container.
    *    - set context
           ls_context-do_commit  = ' '.
           ls_context-called_btc = 'X'.
           ls_context-exec_user  = sy-uname.
           ls_context-fbname     = 'Z_CHECK_RELEASE_CODE'.
           CLEAR lv_wi_handle.
           CALL METHOD cl_swf_run_wim_factory=>initialize( ).
           CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
                   EXPORTING
                      im_wiid             = wi_id
                      im_read_for_update  = ' '
    *                 im_enqueue_owner    = fb_name
    *                 im_wait_for_enqueue = 'X'
                      im_context          = ls_context
                   RECEIVING
                      re_instance         = lv_wi_handle.
    *** This check is only done for workitem linkage TS90100081
           IF lv_wi_handle->m_sww_wihead-wi_rh_task <> 'TS90100081'. "#EC_SYNTEXT
              EXIT. "Let event pass, as this is an instance linkage to another workitem
           ENDIF.
           DATA: releaseCode_wi        TYPE t16fc-frgco.
    *    - read releaseCode from workitem container
           lv_wi_container = lv_wi_handle->get_wi_container( ).
    *    - perform binding event container -> workitem container
           swf_get_element lv_wi_container 'RELEASECODE' releaseCode_wi.
          DATA: e             TYPE REF TO cx_swf_run_wim.
          CATCH cx_swf_run_wim INTO e.
             RAISE WORKFLOW_RUNTIME_ERROR.
       ENDTRY.
    *** From here on, the variable releaseCode_WI hold the
    *** container element RelaseCode of the work item, that
    *** is going to be terminated...
    *** Further coding from here as appropriate...
    Best regards,
    Florin

  • Terminating Event Terminating all work items

    System : Solution Manager
    Business object : BUS2000116
    1. I have multiline container element for Agent.Agents are Dynamic not static.Approval from all agents is required.
    2. Work flow desing
    a.Defination of Agent : ABAP Dictionary type SWP_AGENT with Multiline
    b. FORK with two steps , One step Required
    c. One part of FORK has WAIT FOR EVENT "REJECTED" Event and other has Activity with Agent "_underline []Agent()Index of: Agent _underline"
    d. Under the Miscellaneous tab Multiline line element Agent.
    e. Terminating event for this activitiy is APPROVED Event, which I have defined in business object.
    Let say in Program [Custom tab for standard transaction CRMD_ORDER] I have three agents I am getting Three work item in the workflow log with different Agent.
    PROBLEM:
    When any user open the workitem from SAP Inbox and APPROVE it[ Custom button on standard screen CRMD_ORDER], Program raises Event APPROVED by using Function Module "SWE_EVENT_CREATE". But it set other two work items also in Completed status.
    concatenate 'US' sy-uname into v_creator.
            call function 'SWE_EVENT_CREATE'
              exporting
                objtype                       = c_objtype    "BUS2000116
                objkey                        = objectkey    "Key field Which is GUID from CRMD_ORDERADM_H  table
                event                         = gs_event      "APPROVE"
               creator                       = v_creator
                take_workitem_requester       = 'X'
              START_WITH_DELAY              = ' '
              START_RECFB_SYNCHRON          = ' '
              NO_COMMIT_FOR_QUEUE           = ' '
              DEBUG_FLAG                    = ' '
              NO_LOGGING                    = ' '
              IDENT                         =
             importing
               event_id                      = v_eventid
               receiver_count                = v_count
            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.
            endif.
    Please let me know what could be the reason?
    Thanks in Advance.

    I think instead of using a event you can use a container element. You want to make sure that the users performs the approving action properly. If the user does that inside your code you set this container element as X. You pu the approval step inside a loop that checks whether the container element is X. Also another important thing you need to put the parallel approval step along with the loop inside a subworkflow.
    Thanks
    Arghadip

  • Terminating Event with Decision Step

    Hi,
    In our purchase requisition approval workflow, I need to have a decision step in which to prompt approver to either approve the req. or reject the requisition.  In this decision step, I need for it to have terminating events for "SIGNIFICANTLYCHANGED", "RELEASE", "REJECT" and "RESET".
    First, I copy the generic decision task 8267 to my my own custom decision task.  Then I added a BUS2009 in the container, releasecode and other needed elements.  In this custom decision task, I was able to add these terminating events that has been defined in the BUS2009.  I was able to setup binding, except the one binding
    Terminating Event  ->   Task
    &_EVT_OBJECT&      ->   &_WI_OBJECT_ID&
    Since the &_EVT_OBJECT& for the terminating event is BUS2009.  And the custom decision task &_WI_OBJECT_ID& is DECISION business object. They're incompatable business object.  So I replaced that binding with
    Terminating Event     ->  Task
    &_EVT_OBJECT&    ->   &PURCHASE_REQ&
    After all the configuration has been setup.  I created a new purchase requisition.  Upon the RELEASESTEPCREATED event, it create a custom decision workitem in my agent's inbox.  When I triggered the "RELEASE" event, it is however not terminating my custom decision workitem.  The workitem still sits in the agent's inbox waiting to be execute.
    Is it possible to setup terminating events for decision step?  Any kind of suggestions or inputs would be greatly appreciated.
    Thank you.
    Jennifer Tran
    System Analyst

    I will suggest you to create a fork with 2 parallel branch and 1 necessary branch. Put the approval step in 1 branch and the wait for Release step event in another branch in this way you can suffice your requirment.
    Thanks
    Arghadip

  • Use abap class event as terminating event

    Hi,
       The class is say ZCL_WF_CLASS and the event  END_WF.
    What needs to be done to have this event used correctly as a terminating event of a workflow? Does this event require a parameter to hold the workitem id (or workflow id), as currently this event has no parameters?
    Previous developer has developed the class and event and installed as a terminating event but the workflow is going into error not terminating correctly. I believe the incorrect development of the event and/or its use in the workflow is the issue. Note that nowhere is this event currently raised in any code of the workflow.
    Cheers,
    Ross

    Hello,
    Unless I'm mistaken, a terminating event for a workflow is just like any wait-for event in a workflow.
    It can be based on any object or class and it can be used in various ways - to terminate a branch or terminate the workflow, for example.
    The workflow listens out for the event and checks if there is a matching key. You could base it on the key of a workflow object but it makes more sense to base it on an object or class that's used in the workflow - e.g. the POSTED event of an object would be used to terminate a workflow seeking approval for the posting of an object.
    It definitely won't work if the event has no parameters. I guess if you do base it on the workflow object then you would use the top-level workitem id. Try it with a test workflow and SWUE to generate the event.
    regards
    Rick Bakker
    hanabi technology

  • Workflow- Adding Terminating event into a Decision Step

    Hi
    I have a requirement like, in the decision step for example 'Approve' or 'Reject' has to be executed from the web application by triggering a terminating event for this decision step. I have copied the decision BO DECISION to ZDECISION and created two terminating events and make it ashynchrounous. But this step is not getting executed in the workflow showing error as 'no terminating event is attached to the task'.
    Any input on this is welcome. If you could reply bit early as I need the information ASAP.
    Thanks in advance.
    Padman

    Hi Padman,
    Weclome to the SDN forums. We don't have a specific Workflow forum yet. Please post your questions in the General SDN Forum until we do.
    I moved your questions there.
    Thanks, Mark.

  • Terminating Event in PO Release Workflow. Workitem is not terminating

    Hi WF Experts,
                            I have done Purchase Order Release Workflow with 10 level release With 2 days dead line. Since standard release supports only 8 level release i have opted for Role Resolution Via User Exit 9 . and i am picking release codes from ztable.
    I was working fine till now.But suddenly end users are facing problem that workitem is not terminating even after they have released the PO.
    What could be the issue what is the terminating event for PO Release workitem.
    Please suggest me how to resolve this issue.
    Regards,
    Hari

    Hi Hari,
    Please check if the following links helps:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sap%252bworkflow%252bevents
    http://help.sap.com/saphelp_nw04/helpdata/en/c5/e4b590453d11d189430000e829fbbd/frameset.htm
    Hope this helps!
    Regards,
    Saumya

  • Parallel Processing: Terminating event

    Hi All,
        I am stuck a very strange place in my developement. The situation is in one step I am using parellel processing. The terminating event for that step is EVT1. now lets say the multiline element in step has 4 agents and one of the event does his work and clicks on a particular button triggering EVT1. now this EVt1 will terminate rest 3 parellel branches also which I don`t want. I have tried capturing the event creator using a fork but with  which variable do I compare this event creator (in the end condition) ? I mean the Actual agent wont have a value untill the step is complete.
    Hope I am clear on my requirement.
    Please help.
    Thanks in Adv
    Anuj Sethi

    Hi Anuj
    Got stuck up:))). It is a very tricky scenario. 2 things you can try
    1) Include a key field in your Buisness object that will take care of the issue. Include may be the index of the Multiliner element
    2) You can try to use the same EVT1 as the triggering event of the task also. In the start condition of the task make sure that the Event Creator is not the person who has already approved and also make sure that the task is part of a current workflow that is in progress. Make use of SAP_Workitem_TO_Object.
    So how are you man? It is morning in Brazil. I am mostly awake in SAP forums. Post tough question like this it makes Workflow Consultant think out of the blocks.
    Thanks
    Arghadip

  • Problems with terminating event

    Hi all,
    I defined a terminating event for a task.
    I want all instances of this task to be completed when raising the event.
    I made the binding of the object.
    I defined the event as  a instance linkage(is this correct?)
    Does a terminating event works for a dialog task?
    When I start the event, I get only the following message in the event trace
    'no receiver  entered' but I have the impression that with the instance linkage, you cannot enter receiver data.
    I tried also the type linkages but this gives me this error
    ' task  not defined as start/end event'
    Thanks for any help,
    Hans
    I

    Hello Hans,
    I don't think this is that straightforward, because instance linkage is always use a key. If I understand your question correctly, you have several different tasks with different objects and you want all of them to terminate when a single event is raised. Unfortunately a terminating events will wait for an event using an object instance.
    One workaround would be to use the task as the object whose events you're waiting for. In other words an instance of a subtype of TASK with the key corresponding to your workflow template ID. So now your task is waiting for an event TASK.ZCOMPLETE. The downside to this is that you have to code the task number that you are trying to terminate into wherever you are raising the event.
    Hope that helps.
    Cheers,
    Mike

Maybe you are looking for