14 Replies Latest reply: Apr 4, 2012 2:19 PM by DurgaPrasanth vemula RSS

Required Help in Terminating Events in Activity

DurgaPrasanth vemula
Currently Being Moderated

First basic gata is created workitems should trigger to sales agent.Once a sale view is created and workitem should go to Purchase agent


On MM01 - basic data view - save - mail will go to all sales org (Marketing Agent) on sap workplace with status ready
double click on item & status will become 'reserved; with 3 options:
sale view reqd - open MM01 with sale view
sale view not reqd - will terminate work flow
Cancel & keep work item in inbox - Hold
on cretation of sales view - status will be 'completed' And this is my requirment

 

1) I had used the user Decision(TS00008267) with the two Decision Text

a)sale view reqd 

b)sale view not reqd

And also i created a Agent by using Rule in this User Decision.So that  workitems will trigger.

Based on the above two Decision Text two lines will be generated i.e One line is for sale view reqd and another line is for sale view not reqd

1)In the sales view Req - I created a Activity i.e (custom ) where it opens the MM01 tcode(To open MM01 and i created a Custom Method in Business Object)  and also added the Event in the 'Terminating Events'

2)sale view not reqd - I created a process Control by putting the funciton Cancel Workitem

Until the sales View is created  by sales agents and workitem should not go out from his inbox.Could you please tell me what exactly i need to add in Terminating Events tab of this Activity.

I added the code i.e   SAP_WAPI_CREATE_EVENT in MM01 user exit and created a Custom Event

Could you please tell me what exactly i need to add in Terminating Events tab of this Activity becuase i created a Custom Event and that added this  Event in the Activity of Terminating Event and also in this activity i Added the Method(I.e Custom Method where it open the MM01).but still with out creating Sales view and workitem is going out from inbox.

My Requirement is until the sales Agent is created the salesview  and his workitem should not go out from his inbox.

  • Re: Required Help in Terminating Events in Activity
    Anjan Paul
    Currently Being Moderated

    Hi,

    In the element write _WI_OBJECT_ID, Object catagory BO, Object type BUS2032 and in the event CREATED. Here assumed you take BUS2032 as container element for sales object(its depend on your sales business object).

    • Re: Required Help in Terminating Events in Activity
      DurgaPrasanth vemula
      Currently Being Moderated

      I had writted the code in userexit of MM01

        

        CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
          EXPORTING
            OBJECT_TYPE             =  'ZBS1001006'
            OBJECT_KEY              =  objkey
            EVENT                   =  'SALESVIEWCREATED'
      *     COMMIT_WORK             = 'X'
      *     EVENT_LANGUAGE          = SY-LANGU
      *     LANGUAGE                = SY-LANGU
      *     USER                    = SY-UNAME
      *     IFS_XML_CONTAINER       =
      *   IMPORTING
      *     RETURN_CODE             =
      *     EVENT_ID                =
      *   TABLES
      *     INPUT_CONTAINER         =
      *      MESSAGE_LINES           = lt_msglines
      *     MESSAGE_STRUCT          =
                  .
        if sy-subrc eq 0.
          commit work.
           endif.

       

      I created the Event  'SALESVIEWCREATED '  in SWO1 in the business object 'ZBS1001006'

      and in the Activity and as you had i added the

      _WI_OBJECT_ID as Element

      BO in Object Category

      ZBS1001006 as Object Type

      'SALESVIEWCREATED' as Event

      but still it is not working

       

       

      • Re: Required Help in Terminating Events in Activity
        Anjan Paul
        Currently Being Moderated

        Hi,

        I think salesvew step is not asychronous thats why it is going out of inbox.

        The best  way you can use asynchronous method in the salesview step there you mention terminating method. Then call the task TS00008267.


      • Re: Required Help in Terminating Events in Activity
        Gianluca Bonavitacola
        Currently Being Moderated

        I didn't understand exacltly your requirements but the "terminating event" is usually related to an asyncronous method of your BO. So, please check your task and method.

        Regards,
            Gianluca

        • Re: Required Help in Terminating Events in Activity
          DurgaPrasanth vemula
          Currently Being Moderated

          Could you please let me know how  to create the asyncronous method of my BO.becuase when creating Method in BO there will be checkbox  i.e

          1.Dailog

          2.syncronous

          i should uncheck the syncronous check box that is enough?

          Could you please help me how to create the asyncronous method

          • Re: Required Help in Terminating Events in Activity
            Gianluca Bonavitacola
            Currently Being Moderated

            Uncheck syncronous... and good luck!

            • Re: Required Help in Terminating Events in Activity
              DurgaPrasanth vemula
              Currently Being Moderated

              I am using user exit EXIT_SAPLMGMU_001 in that there is include '

                ZXMG0U02'.

              where user hit save button in MM01 and it triggers this include   ZXMG0U02'. in this user exit.

               

              1)As per my requirment there are 17 views for MM01 and for every view i need to write Terminating Event in the Activity of my workflow

               

              2)I had writted the code in the userexit

              First for SalesView creation it is working fine and first it goes to the below code of the first time function module 'SAP_WAPI_CREATE_EVENT' and it is getting saved and Sales Data is getting and workitem is going out from inbox

               

                 CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
                  EXPORTING
                    OBJECT_TYPE             =  'ZBS1001006'
                    OBJECT_KEY              =  objkey
                    EVENT                   =  'SALESVIEWCREATED'
              *     COMMIT_WORK             = 'X'
              *     EVENT_LANGUAGE          = SY-LANGU
              *     LANGUAGE                = SY-LANGU
              *     USER                    = SY-UNAME
              *     IFS_XML_CONTAINER       =
              *   IMPORTING
              *     RETURN_CODE             =
              *     EVENT_ID                =
              *   TABLES
              *     INPUT_CONTAINER         =
              *      MESSAGE_LINES           = lt_msglines
              *     MESSAGE_STRUCT          =
                          .
                if sy-subrc eq 0.
                  commit work.
                   endif.

               

              *Check storage view is created or not

                 select single * from mard into gds_mard
                  where matnr eq WMARD-matnr
                    and werks eq WMARD-WERKS
                    and lgort eq WMARD-LGORT.

              objkey = WMARD-matnr.

                 if sy-subrc ne 0.

                    CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
                  EXPORTING
                    OBJECT_TYPE             =  'ZBS1001006'
                    OBJECT_KEY              =  objkey
                    EVENT                   =  'STORAGEVIEWCREATED'
              *     COMMIT_WORK             = 'X'
              *     EVENT_LANGUAGE          = SY-LANGU
              *     LANGUAGE                = SY-LANGU
              *     USER                    = SY-UNAME
              *     IFS_XML_CONTAINER       =
              *   IMPORTING
              *     RETURN_CODE             =
              *     EVENT_ID                =
              *   TABLES
              *     INPUT_CONTAINER         =
              *      MESSAGE_LINES           = lt_msglines
              *     MESSAGE_STRUCT          =
                          .
                if sy-subrc eq 0.
                  commit work.
                   endif.

                endif.

               

              Now the workitem comes to create Storage view and it should navigate to second fucntion module with the Event 'STORAGEVIEWCREATED'.but the issue it goes to the first function module i.e with the Event ''SALESVIEWCREATED' and it is coming out from that Exit.

               

              I want to go to function module for the Event 'STORAGEVIEWCREATED' by skipping when i create the 'STORAGEVIEW

               

              When i hit save button in MM01 and it navigates to this user Exit for the first function module with the Eventname 'SALESVIEWCREATED' and it coming out from Exit and not going to another function module which has  Event 'STORAGEVIEWCREATED'

               

               

          • Re: Required Help in Terminating Events in Activity
            Anjan Paul
            Currently Being Moderated

            Hi,

            yes Unchecking Synchronus is enough. And after creating the method when you use it in task there also  it is automatically uncheck in task level.

            • Re: Required Help in Terminating Events in Activity
              DurgaPrasanth vemula
              Currently Being Moderated

              I am using user exit EXIT_SAPLMGMU_001 in that there is include '

                ZXMG0U02'.

              where user hit save button in MM01 and it triggers this include   ZXMG0U02'. in this user exit.

               

              1)As per my requirment there are 17 views for MM01 and for every view i need to write Terminating Event in the Activity of my workflow

               

              2)I had writted the code in the userexit

              First for SalesView creation it is working fine and first it goes to the below code of the first time function module 'SAP_WAPI_CREATE_EVENT' and it is getting saved and Sales Data is getting and workitem is going out from inbox

               

                 CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
                  EXPORTING
                    OBJECT_TYPE             =  'ZBS1001006'
                    OBJECT_KEY              =  objkey
                    EVENT                   =  'SALESVIEWCREATED'
              *     COMMIT_WORK             = 'X'
              *     EVENT_LANGUAGE          = SY-LANGU
              *     LANGUAGE                = SY-LANGU
              *     USER                    = SY-UNAME
              *     IFS_XML_CONTAINER       =
              *   IMPORTING
              *     RETURN_CODE             =
              *     EVENT_ID                =
              *   TABLES
              *     INPUT_CONTAINER         =
              *      MESSAGE_LINES           = lt_msglines
              *     MESSAGE_STRUCT          =
                          .
                if sy-subrc eq 0.
                  commit work.
                   endif.

               

              *Check storage view is created or not

                 select single * from mard into gds_mard
                  where matnr eq WMARD-matnr
                    and werks eq WMARD-WERKS
                    and lgort eq WMARD-LGORT.

              objkey = WMARD-matnr.

                 if sy-subrc ne 0.

                    CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
                  EXPORTING
                    OBJECT_TYPE             =  'ZBS1001006'
                    OBJECT_KEY              =  objkey
                    EVENT                   =  'STORAGEVIEWCREATED'
              *     COMMIT_WORK             = 'X'
              *     EVENT_LANGUAGE          = SY-LANGU
              *     LANGUAGE                = SY-LANGU
              *     USER                    = SY-UNAME
              *     IFS_XML_CONTAINER       =
              *   IMPORTING
              *     RETURN_CODE             =
              *     EVENT_ID                =
              *   TABLES
              *     INPUT_CONTAINER         =
              *      MESSAGE_LINES           = lt_msglines
              *     MESSAGE_STRUCT          =
                          .
                if sy-subrc eq 0.
                  commit work.
                   endif.

                endif.

               

              Now the workitem comes to create Storage view and it should navigate to second fucntion module with the Event 'STORAGEVIEWCREATED'.but the issue it goes to the first function module i.e with the Event ''SALESVIEWCREATED' and it is coming out from that Exit.

               

              I want to go to function module for the Event 'STORAGEVIEWCREATED' by skipping when i create the 'STORAGEVIEW

               

              When i hit save button in MM01 and it navigates to this user Exit for the first function module with the Eventname 'SALESVIEWCREATED' and it coming out from Exit and not going to another function module which has  Event 'STORAGEVIEWCREATED'

               

Actions