4 Replies Latest reply: Feb 29, 2012 7:30 AM by Yayati Ekbote RSS

Workflow not getting triggered from webdynpro event

Yayati Ekbote
Currently Being Moderated

Hello gurus,

I have a requirement in which if an employee changes his own information on the ESS portal, then an approval should be done by HR. For this i created a custom webdynpro application in which i fetch the employee data and check it with old data in one view and when user clicks save button the approval workflow should be triggered.

For this i created a custom BO using transaction SWO1. I added a 'CHANGE' event and 'send_data_to_wf' method.

In SWDD i created the workflow which is working fine when i test it in SWDD only. But when i trigger it using FM 'SWE_CREATE_EVENT', only the event is getting triggered and not the workflow. I checked the trace in transaction SWEL in which i can see the 'CHANGE' event under Event column but Name of Reciever Type column is emty. It should display my custom workflow ID. Please let me know where i m lacking or going wrong.

 

Regards,

Yayati Ekbote

  • Re: Workflow not getting triggered from webdynpro event
    Ricardo Romero
    Currently Being Moderated

    Hi,

     

    It's strange.

     

    It's the linkage active in swetypv / swe2?

    Have you tried with the FM SAP_WAPI_CREATE_EVENT ?

    • Re: Workflow not getting triggered from webdynpro event
      Yayati Ekbote
      Currently Being Moderated

      Hello Ricardo,

      Thanks for immediate reply. Yes, the linkage is active in SWE2. My custom object type is ZHRAD and event is change. I also tried the FM 'SAP_WAPI_CREATE_EVENT'. But in this FM the event also doesn't get triggered. Using FM 'SWE_CREATE_EVENT' atleast triggers the event. I debugged the FM. The container inside the FM is remaining initial. I am posting my code which i am using.

      
      DATA: pernr TYPE pa0001-pernr VALUE '40000001'.
      
        DATA: objtype   TYPE swr_struct-object_typ VALUE 'ZHRADCHO',
              objkey    TYPE sweinstcou-objkey,
              event     TYPE swr_struct-event VALUE 'CHANGE',
              it_wfcont TYPE STANDARD TABLE OF swcont,
              wa_wfcont TYPE swcont,
              event_id  TYPE swedumevid-evtid,
              ret_code  TYPE swedumevid-evtid.
      
        wa_wfcont-element = 'PERNR'.
        wa_wfcont-value = '40000001'.
        APPEND wa_wfcont TO it_wfcont.
      
        wa_wfcont-element = 'SUBTY'.
        wa_wfcont-value = '1'.
        APPEND wa_wfcont TO it_wfcont.
      
        wa_wfcont-element = 'ENDDA'.
        wa_wfcont-value = sy-datum.
        APPEND wa_wfcont TO it_wfcont.
      
        wa_wfcont-element = 'BEGDA'.
        wa_wfcont-value = sy-datum.
        APPEND wa_wfcont TO it_wfcont.
      
        objkey = pernr.
      
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype                       = objtype
          objkey                        = objkey
          event                         = event
      *   CREATOR                       = ' '
      *   TAKE_WORKITEM_REQUESTER       = ' '
      *   START_WITH_DELAY              = ' '
      *   START_RECFB_SYNCHRON          = ' '
      *   NO_COMMIT_FOR_QUEUE           = ' '
      *   DEBUG_FLAG                    = ' '
      *   NO_LOGGING                    = ' '
      *   IDENT                         =
      * IMPORTING
      *   EVENT_ID                      =
      *   RECEIVER_COUNT                =
       TABLES
         EVENT_CONTAINER               = it_wfcont
       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.
      
      COMMIT WORK.
      

       

Actions