cancel
Showing results for 
Search instead for 
Did you mean: 

wait for event step..

Former Member
0 Kudos

hi all,

I have a wait for event step in my owrkflow and it is working fine. My problem us i am not able to trigger this event using program can anyone please let me know what i am doing wrong. following is the code i am using to trigger the event


 DATA: key TYPE SWEINSTCOU-OBJKEY,
        object  TYPE  SWETYPECOU-OBJTYPE,
        event TYPE SWETYPECOU-EVENT.

  DATA: event_id LIKE swr_struct-event_id,
        return_code LIKE sy-subrc,
        input_container TYPE swr_cont OCCURS 0 WITH HEADER LINE,
        message_lines TYPE swr_messag OCCURS 0 WITH HEADER LINE,
        message_struct TYPE swr_mstruc OCCURS 0 WITH HEADER LINE.

*  CONCATENATE pernr reinr INTO key.

key = reinr.

  object = 'BUS2089'.

  IF action = 'APPROVED'.
    event = 'APPROVED'.
  ELSEIF action = 'REJECTED'.
    event = 'CANCELLED'.
  ENDIF.

*  swc_create_object object 'BUS2089' key.

  CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
    EXPORTING
      object_type             = 'BUS2089'
      object_key              =  key
      event                   = event
     commit_work             = 'X'
     event_language          = sy-langu
     language                = sy-langu
     user                    = sy-uname
*    IFS_XML_CONTAINER       =
   IMPORTING
     return_code             = return_code
     event_id                = event_id
   TABLES
     input_container         = input_container
     message_lines           = message_lines
     message_struct          = message_struct
            .

*
commit WORK.

however if i execute the FM SAP_WAPI_CREATE_EVENT by passing the values it works fine.

Thanks

Saurabh

Accepted Solutions (1)

Accepted Solutions (1)

bpawanchand
Active Contributor
0 Kudos

Hi

however if i execute the 
FM SAP_WAPI_CREATE_EVENT by passing 
the values it works fine.

It will trigger only when you execute the above function module or

SWE_EVENT_CREATE because

You have a BO and an event associated with it now when you want to trigger this this event through program then you have to make a kind of mapping between BO and your program so thta's what this Fm does, when ever you execute the program as you are passing all the values to the Function the Evnt associated with the BO is triggered.

In order to trigger use SWE_EVENT_CREATE aand after calling this fucntion use COMMIT WORK statement

Could you let me know what condidtion did you write for the WAIT step to continue.

Regards

Pavan

Answers (1)

Answers (1)

martin_nooteboom
Active Contributor
0 Kudos

You probably found this yourself also because the question is answered, but the key is not correct in your program.

Regards,

Martin