cancel
Showing results for 
Search instead for 
Did you mean: 

How trigger the workflow using CL_EHHSS_PCO_INC_LC in EHSM through program

pasumpon_karuppaiah
Participant
0 Kudos

Hi Expert ,

I have requirement to trigger the workflow by manually for the old incident in EHSM. Then I have created the program to trigger the workflow for the old INCIDENT . But i got error in the first step of my workflow  (Start Processing Method ). 

My code :

data : lv_ret      type sy-subrc,

        lt_msglines type table of swr_messag,

        ls_msglines type swr_messag,

        lt_mstr     type table of swr_mstruc,

        ls_mstr     type swr_mstruc.

data: lv_objtype           type sibftypeid,

       lv_event             type sibfevent,

       lr_event_parameters  type ref to if_swf_ifs_parameter_container,

       lv_title_event       type char80,

       lv_date_time         type char15,

       lv_incident_reporter type char12,

       lv_location1         type char16,

       vehicle_details      type char15.

lv_objtype = 'CL_EHHSS_PCO_INC_LC'.

lv_event   = 'CREATED'.


call method cl_swf_evt_event=>get_event_container

   exporting

     im_objcateg  = cl_swf_evt_event=>mc_objcateg_cl

     im_objtype   = lv_objtype

     im_event     = lv_event

   receiving

     re_reference = lr_event_parameters.

" Pass Title

try.

     call method lr_event_parameters->set

       exporting

         name  = 'TITLE'

         value = 'Test Title'.


   catch cx_swf_cnt_cont_access_denied .

   catch cx_swf_cnt_elem_access_denied .

   catch cx_swf_cnt_elem_not_found .

   catch cx_swf_cnt_elem_type_conflict .

   catch cx_swf_cnt_unit_type_conflict .

   catch cx_swf_cnt_elem_def_invalid .

   catch cx_swf_cnt_container .

endtry.


" Pass Date and time

try.

     call method lr_event_parameters->set

       exporting

         name  = 'START_TIMESTAMP'

         value = '15.06.2015 10.28.00'.

   catch cx_swf_cnt_cont_access_denied .

   catch cx_swf_cnt_elem_access_denied .

   catch cx_swf_cnt_elem_not_found .

   catch cx_swf_cnt_elem_type_conflict .

   catch cx_swf_cnt_unit_type_conflict .

   catch cx_swf_cnt_elem_def_invalid .

   catch cx_swf_cnt_container .

endtry.

"Pass Incident ID

try.

     call method lr_event_parameters->set

       exporting

         name  = 'ID'

         value = '00000000000000001703'.

   catch cx_swf_cnt_cont_access_denied .

   catch cx_swf_cnt_elem_access_denied .

   catch cx_swf_cnt_elem_not_found .

   catch cx_swf_cnt_elem_type_conflict .

   catch cx_swf_cnt_unit_type_conflict .

   catch cx_swf_cnt_elem_def_invalid .

   catch cx_swf_cnt_container .

endtry.



data: lv_key   type char32,

       re_event type ref to if_swf_evt_event.

lv_key = '9C8E9923D08C1EE68CDC60519C93B885'.

try.

     call method cl_swf_evt_event=>get_instance

       exporting

         im_objcateg        = cl_swf_evt_event=>mc_objcateg_cl

         im_objtype         = lv_objtype

         im_event           = lv_event

         im_objkey          = lv_key

*        im_event_container = lr_event_parameters

       receiving

         re_event           = re_event.

   catch cx_swf_evt_invalid_objtype .

   catch cx_swf_evt_invalid_event .

endtry.

try.

     call method cl_swf_evt_event=>raise

       exporting

         im_objcateg        = cl_swf_evt_event=>mc_objcateg_cl

         im_objtype         = lv_objtype

         im_event           = lv_event

         im_objkey          = lv_key

         im_event_container = lr_event_parameters.

   catch cx_swf_evt_invalid_objtype .

   catch cx_swf_evt_invalid_event .

endtry.

commit work.

Could you please correct my code if i pass any wrong container value or Missed any logic to trigger the workflow .

Workflow error screen shot.

Thanks,'

Pasumpon Karuppaiah

Accepted Solutions (0)

Answers (1)

Answers (1)

pokrakam
Active Contributor
0 Kudos

There must be several hundred mentions on here to use the API (SAP_WAPI_* functions) to interact with workflow.

SAP_WAPI_CREATE_EVENT_EXTENDED  is the one you're after.

Regards,

Mike