The SES workflow is triggered on creation of the SES. The event Created actually gtes triggered from Business object BUS2091 on creation of SES.
Below snapshot shows the work item gets generated with status of ‘ready’ for SES 1000001563 and t is in the approver’s inbox.
Now before the approver approves the SES work item, the Service entry sheet is deleted as shown below.
Go back to the SES (ML81N) and delete it:
Once the SES is deleted, then you need to use below user exit which is trigger on save and place the code in it to delete the work item for the deleted SES.
USER EXIT: EXIT_SAPLMLSR_001
Include: ZXMLUU18
See the attached Code(ZXMLUU18.TXT)
User Exit Code to delete the work item.
*Local Data Declartion.
DATA : lv_workitem TYPE sww_wiid,
lv_text TYPE sww_witext.
* Local Constant declaration
CONSTANTS : lc_x TYPE char1 VALUE 'X',
lc_w TYPE char1 VALUE 'W',
lc_f TYPE char1 VALUE 'F',
lc_i TYPE char1 VALUE 'I',
lc_eq TYPE char2 VALUE 'EQ',
lc_perc TYPE char1 VALUE '%',
lc_inproc TYPE char7 VALUE 'STARTED',
lc_ready TYPE char5 VALUE 'READY'.
* Ranges declaration
RANGES: r_status FOR swwwihead-wi_stat.
* Get the status in the range.
r_status-sign = lc_i.
r_status-option = lc_eq.
r_status-low = lc_ready.
APPEND r_status.
r_status-low = lc_inproc.
APPEND r_status.
WAIT UP TO 5 SECONDS.
* If the Service Entery Sheet is deleted then run the below code.
IF i_essr-loekz EQ lc_x.
CLEAR: lv_workitem,
lv_text.
CONCATENATE lc_perc i_essr-lblni lc_perc INTO lv_text.
* Get the workitem ID for the Service Entry Sheet.
SELECT wi_id UP TO 1 ROWS
INTO lv_workitem
FROM swwwihead
WHERE ( wi_type EQ lc_w OR
wi_type EQ lc_f )
AND wi_text LIKE lv_text
AND wi_stat IN r_status.
ENDSELECT.
* Delete the workitem from approver's inbox.
IF sy-subrc = 0 AND lv_workitem IS NOT INITIAL.
CALL FUNCTION 'SWW_WI_ADMIN_CANCEL'
EXPORTING
wi_id = lv_workitem
* DO_COMMIT = lc_x
authorization_checked = ' '
preconditions_checked = lc_x
* CALLED_BY_PROXY = ' '
* IMPORTING
* NEW_STATUS =
EXCEPTIONS
update_failed = 1
no_authorization = 2
infeasible_state_transition = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
e_edit = 'X'.
The above code can be used to delete the work item for the approver’s inbox for the deleted SES.
Once the SES is deleted, the delete sign can be seen as shown above.
Go back to the SBWP – now the work for SES 1000001563 is gone. The SES work item is also deleted when the SES was deleted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |