on 09-16-2014 2:17 PM
Hi Experts,
Please let me know how to trigger the WF - WS00500001 with object type - CL_EHHSS_PCO_INC_LC and Event - CREATED. And given data below.
1. Title / Event :
Table: EHHSSD_INC_BINFA
Field name: TITLE
Data element: EHHSS_INC_TITLE
Data type (Format): Character format
Length: 80 characters
2. Data and Time
Table: EHHSSD_INC_BINFA
Field name: DATETIME_CR
Data Element: /BOBF/DATETIME_CR
Data type(Format): System format (Example : 31.07.2014 time 10:00 )
Length: 15
3. Incident Reporter
Table: EHHSSD_INC_BINFA
Field name: USER_ID_CR
Data Element: /BOBF/USER_ID_CR
Data Type(Format): CHARACTER
Length: 12 Characters
4. Locations
Table: EHHSSD_INC_BINFA
Field name: LOC_ROOT_KEY_REF
Data Element: EHFND_LOCATION_KEY_REF
Data Type(Format): RAW (It will accept characters and numbers )
Length: 16
5. Vehicle details
Table: EHHSSD_INC_VEHIC
Field for vehicle description: VEHICLE_DESC
Data element for vehicle description: EHFND_VEHICLE_DESC
Data type(Format): CHARACTER
Length: 40
Failed to trigger with below code
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'CL_EHHSS_PCO_INC_LC'
OBJKEY = LV_REPORT
EVENT = 'CREATED'
TABLES
EVENT_CONTAINER = GIT_EVT
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.
Regards,
Srivijay
Issue resolved, able to trigger it with below code.
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 .
lv_TITLE_EVENT = LV_TITLE.
lv_DATE_TIME = lv_date.
lv_INCIDENT_REPORTER = LV_REPORTER.
lv_LOCATION1 = LV_LOCATION.
VEHICLE_DETAILS = LV_VEHICLE.
try.
CALL METHOD lr_event_parameters->set
EXPORTING
name = 'TITLE'
value = lv_TITLE_EVENT.
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 char20.
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.
Thank you Siraj, Murali and Rick for your kind responses 🙂
Regards,
Srivijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srivijay,
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.
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=>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
Hi,
I have tried the same trigger the workflow for incident. But we are getting the below error.
Exception occurred in CL_EHFND_WFF_ROOT_PCO=========CP(CL_EHFND_WFF_ROOT_PCO=========CM00F) line
Message no. CM_EHFND_FW_WFF_PCO100
can anyone guide here.
Our requirement is to trigger the workflow when editing the incident and click on SAVE button.
For SAVE button in standard, there is no workflow trigger process. Hence I have created an enhancement for SAVE action and tried with the above logic. But I am facing above error.
Its really appreciable and will give points from myside -:).
Thank you in advance.
Best regards
Siva
Hi Srivijay,
I getting empty work item when in workflow when executed these code.
Appreciate if you could give some tips.
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_parameter.
try.
CALL METHOD lr_event_parameters->set
EXPORTING
name = 'TITLE'
value = 'test_150520151'.
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.
try.
CALL METHOD lr_event_parameters->set
EXPORTING
name = 'START_TIMESTAMP'
value = '15.05.2015 00:00: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.
try.
CALL METHOD lr_event_parameters->set
EXPORTING
name = 'ID'
value = 'DXXXXX'.
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 char20.
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.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Always try to use an event to start a workflow instead of starting it directly.
As stated above, you should use SAP_WAPI_CREATE_EVENT.
Is the event being created? Check in SWEL (may need to turn it on via SWELS).
If so, check that the event is linked to the workflow by looking in the Start Events of the workflow.
regards
Rick Bakker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi SriVijay,
Try to trigger the event with FM SAP_WAPI_CREATE_EVENT .
If you want to trigger a specific workflow you can use FM SAP_WAPI_START_WORKFLOW, here you can directly mention WS00500001 in the Task.
Regards,
Murali Krishna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murali,
Thanks for reply.
But I am still getting below error when I try to trigger through FM SAP_WAPI_START_WORKFLOW.
You are not one of the possible agents of task 'WS00500001'
And I can't use FM SAP_WAPI_CREATE_EVENT, because I don't have key to pass. Based on 5 values I have shared, I need to trigger the WF.
Regards,
Srivijay
Hi Srivijay,
Try trigger the workflow using this FM "SAP_WAPI_CREATE_EVENT".
Let me know if its not successfully.
Regards,
Siraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.