Skip to Content
author's profile photo
Former Member

Unable to trigger event

Hi,

I have followed the steps for creating a BOR in SWO1, creating the workflow template in SWDD and linking the event and workflow in SWETYPV.

I have tested it manually in SWUE and SWEL shows that the event is triggered. However, when I try to trigger it in from a report, I am unable to do so. My codes are:

<i> DATA: l_objkey TYPE sweinstcou-objkey.

l_objkey = '100019000011942007'.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

objtype = 'ZFIPP'

objkey = l_objkey

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

.</i>

Did I miss anything? I have another question. Is there a difference between using receiver function SWW_WI_CREATE_VIA_EVENT and SWW_WI_CREATE_VIA_EVENT_IBF?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    Posted on Aug 19, 2007 at 06:42 AM

    Hi NB,

    hope you have done all the settings reqd for parked document.

    as far the events, SWW_WI_CREATE_VIA_EVENT_IBF is present in 6.2 versions, difference I do not know much, as interface in both cases are the same.

    Aditya

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 19, 2007 at 03:10 PM

    Hi,

    May I know what are the settings required for parked document?

    I just created a simple report with the above codes. But it is unable to trigger the workflow. I tried using function 'SWU_START_WORKFLOW' instead to call the workflow directly and it works.

    Hmm, somehow I just cant get the workflow to be event triggered from my report. Any ideas?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi check the code below and code accordingly for parked document.

      INCLUDE <cntn01> .

      DATA:i_emp_details TYPE STANDARD TABLE OF p0001, "Employee Details

      wa_request TYPE p0001, "Workarea for Employee details

      v_country_grp TYPE molga, "Country SubGrouping

      v_object_key TYPE sweinstcou-objkey. "Key for the buisness object ZWOBUSTRIP

      CONSTANTS: c_bo_trip TYPE swo_objtyp VALUE 'ZWOBUSTRIP',

      c_event_trip TYPE swo_event VALUE 'TripCreate',

      c_infy_type_1 TYPE infty VALUE '0001'.

      • Event Container declaration

      swc_container i_event_cont.

      swc_create_container i_event_cont.

      • Reading the INFO TYPE 0001 to obtain the

      • Employee details

      CALL FUNCTION 'HR_READ_INFOTYPE'

      EXPORTING

      pernr = i_emp_number

      infty = c_infy_type_1

      begda = sy-datum

      endda = sy-datum

      TABLES

      infty_tab = i_emp_details

      EXCEPTIONS

      infty_not_found = 1

      OTHERS = 2.

      • SY-SUBRC check is not required as the error

      • handelling will be done by WorkFlow rule

      • resolution.

      CLEAR wa_request.

      READ TABLE i_emp_details INTO wa_request INDEX 1.

      IF sy-subrc = 0.

      • Retrieving the Country SubGrouping for the employee

      SELECT SINGLE molga

      FROM t001p

      INTO v_country_grp

      WHERE werks = wa_request-werks

      AND btrtl = wa_request-persk.

      ENDIF.

      • Sending the relevant data to event container

      swc_set_element i_event_cont 'EmpId' i_emp_number.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      swc_set_element i_event_cont 'PersonnelArea' wa_request-werks.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      swc_set_element i_event_cont 'CountryGrouping' v_country_grp.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      swc_set_element i_event_cont 'EmpSubGrp' wa_request-persk.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      swc_set_element i_event_cont 'EmpTripId' i_emp_trip.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      • Raising the event to trigger the workflow

      v_object_key = i_emp_number.

      CALL FUNCTION 'SWE_EVENT_CREATE'

      EXPORTING

      objtype = c_bo_trip

      objkey = v_object_key

      event = c_event_trip

      TABLES

      event_container = i_event_cont

      EXCEPTIONS

      objtype_not_found = 1

      OTHERS = 2.

      IF sy-subrc <> 0.

      • No Processing needed.

      ENDIF.

      COMMIT WORK.

      ENDFUNCTION.

      <b>Pleae rewrad points if useful</b>

      thanks

      Arghadip

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 06:46 AM

    use commit work at the end of the function call.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 06:47 AM

    use <b>COMMIT WORK</b> at the end of the function call.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 07:31 AM

    yep you guys are right, it's commit work that i am missing. thanks, points awarded. 😊

    Add comment
    10|10000 characters needed characters exceeded