on 01-07-2008 8:01 PM
I'm using SWE_EVENT_CREATE to generate a wf item in the inbox - using object type Z_SOFM based on SOFM. But the item only appears if the debug_flag parameter is set. If the flag is not set, there is no inbox item (and no errors). As well, if I try tracing with SWELS/SWEL, the trace is generated only if the debug_flag is set. Can you tell me why, or what I'm missing?
Thanks
I think you can use FM
SAP_WAPI_START_WORKFLOW
instead of FM SWE_EVENT_CREATE
but I am quite sure dialog workitems will not depend on parameters of in FM. If you pass key fields correctly it will work.
Check this code
FUNCTION zwf_process_trip.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(I_EMP_NUMBER) TYPE PERNR_D
*" VALUE(I_EMP_TRIP) TYPE REINR
*"----
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.
Thanks
Arghadip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The commit suggestion and use of SAP_WAPI_CREATE_EVENT were both helpful but did not, by themselves, resolve the problem. I had to rerun SWU3 as not all customizing options were active.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As already pointed out you should ensure that a COMMIT WORK takes place, but you should also use the proper function module to create your event. Use SAP_WAPI_CREATE_EVENT which has been released for customer use for a long time. You can either call COMMIT WORK yourself, or simply pass X as the value of the importing parameter COMMIT_WORK.
It is in almost all cases better design to use SAP_WAPI_CREATE_EVENT than to start the workflow directly with SAP_WAPI_START_WORKFLOW, so I would recommend that you stick to your current design.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Are you using executing this FM SWE_EVENT_CREATE alone, i mean executing it from SE37?
Actually after making this call its better to do an explicit commit work using commit work statement. Otherwise we do not know when it get commit based on LUWs.
But in general it should work, just try giving a explcit commit work statement after your call and see !!
Aparti from raising event you should also make sure event linkage, check FMs, start conditions if any to have your workflow start correctly.
Good Luck !!
Regards
Krishna Mohan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.