Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reg : cl_swf_evt_event Event Parameter Passing

karthik_snair
Participant
0 Kudos
976

Hi Team,

I am using this class to raise an event and this event is having a parameter that i am passing.

And in my case the Receiver is a function Module.So now my doubt is how can i get the Parameter value which i have set while triggering the event.

When i am trying to get the parameter value of the event by using the GET method of the class i am not getting the parameter value.

So my question is, Initially i am creating an event container and setting the event parameter and then raising the event.

Now i need to get the same event container so that what ever the value i have set, i can get it.SO how can i get the same event container instance.

When ever i am using the method  get_event_container it is creating a new instance.

I need a method to call an existing instance where i can get the parameter value which i have set earlier.

Note : This event is triggering in the Update Module in an exit and this handler of this event will execute upon commit.

          Parameter is Passing correctly. Trace is available in SWEL with this event. 

Please share your ideas how can i achieve this?

--

Karthik.S

1 REPLY 1

roberto_vacca2
Active Contributor
0 Kudos
184

Hi.

Which are your steps?

* I suggest this:

* GET THE INSTANCE OF CONTAINER - FILL IT WITH DATA

CALL METHOD cl_swf_evt_event=>get_event_container

  EXPORTING

    im_objcateg  = lv_objcateg                         "  Class Or Business Object      

    im_objtype   = 'ZCLSWFTEST'  " Class Name Or BO Name (BUS2018)

    im_event     =  'START_WRKFLW'              "Event name

  RECEIVING

    re_reference = lo_ref_parameters.



* Set container event parameters

CALL METHOD lo_ref_parameters->set
  EXPORTING
    name  = 'Field1'
    value = f_value1.

CALL METHOD lo_ref_parameters->set
  EXPORTING
    name  = 'Field2'
    value = f_value2.

* And Finally raise your event

TRY.
    CALL METHOD cl_swf_evt_event=>raise
      EXPORTING
        im_objcateg        = lv_objcateg           "  Class Or Business Object      
        im_objtype         = 'ZCLSWFTEST'   " Class Name Or BO Name (BUS2018)
        im_event           = 'START_WORKFLOW'      "Event Name
        im_objkey          = lv_objkey                          "Key Field of BO or CLASS
        im_event_container = lo_ref_parameters.  "Event Container


    COMMIT WORK AND WAIT.
    WRITE: / 'Event Triggered.'.


  CATCH cx_swf_evt_invalid_objtype .
    WRITE: / 'Exception - CX_SWF_EVT_INVALID_OBJTYPE'.
  CATCH cx_swf_evt_invalid_event .
    WRITE: / 'Exception - CX_SWF_EVT_INVALID_EVENT'.


ENDTRY.

YOu should find your data finally in lo_ref_parameters.

Hope to help

Bye