Escalation only on workdays in the MSMP workflow
I really like the concept of enhancements, as it gives the flexibility to change the behavior of the application from the standard to a custom requirement. There is a step by step WIKI about creating simple enhancements, which is helpful to get started: Enhancement Framework – Class Enhancements – Pre-exit, Post-exit and Overwrite-exit methods – Concept and Simple Scenari…
In SAP GRC Access Control 10.x releases the weekend days and public holidays are also considered setting the escalation time according to MSMP stage level settings per standard. Although it can be a requirement to restrict the escalation to working days only and this can be easily achieved by creating an enhancement. To determine the workdays the best approach is to use the factory calendar in the SAP system, see Creating Factory/Holiday Calendar. First it needs to be decided to choose an existing factory calendar or create a new one in SCAL transaction.
To enable escalation only on workdays the class CL_GRFN_MSMP_WF_TEMPLATE_BASE has to be enhanced by applying an overwrite-exit method to the method GET_ESCALATION_SETTINGS. This method calls the function module END_TIME_DETERMINE, which has the optional parameter FACTORY_CALENDAR. Copy the standard code into the overwrite-exit method and add the Factory Calendar ID, which has been chosen from SCAL transaction. Now the escalation date and time is calculated considering working days only, as maintained in the factory calendar.
*” Declaration of Overwrite-method, do not insert any comments here please!
*” !IS_MSMP_EXEC_CONTEXT type GRFN_MW_S_EXECUTION_CONTEXT
*” !IS_STAGE type GRFNMWCNSTGV
*” value(ES_ESCALATION_SETTINGS) type GRFNMW_S_TEMPLATE_ESCALATION
*” CX_GRFN_MSMP .
DATA: ls_escalation_settings TYPE grfnmw_s_template_escalation,
l_escalation_user TYPE grfn_mw_wf_appr_usr.
DATA ls_global_settings TYPE grfnmwcnglbset.
DATA: end_date LIKE sy–datum,
end_time LIKE sy–uzeit,
start_date LIKE sy–datum,
start_time LIKE sy–uzeit.
DATA: lv_timestamp TYPE timestampl.
ls_global_settings = cl_grfn_msmp_configuration=>get_global_settings( is_msmp_exec_context–process_id ).
IF is_stage–escalation_type <> grfnw_msmp_c_escalation_type–no_escalation.
IF ( ls_global_settings–escalation_enble EQ abap_true ).
ls_escalation_settings–requested_esclation_date = ls_global_settings–escalation_date.
ls_escalation_settings–escalation_type = is_stage–escalation_type.
GET TIME STAMP FIELD lv_timestamp.
* convert to date and time
CONVERT TIME STAMP lv_timestamp TIME ZONE sy–zonlo INTO DATE start_date TIME start_time.
* calculate time
CALL FUNCTION ‘END_TIME_DETERMINE’
duration = is_stage–escalation_time
unit = grfnw_msmp_c_duration_units–minutes
factory_calendar = ‘EU’ “Factory Calendar ID from SCAL transaction
end_date = end_date
end_time = end_time
start_date = start_date
start_time = start_time
factory_calendar_not_found = 1
date_out_of_calendar_range = 2
date_not_valid = 3
unit_conversion_error = 4
si_unit_missing = 5
parameters_no_valid = 6
error_message = 7
OTHERS = 7.
IF sy–subrc = 0.
ls_escalation_settings–latest_end_date = end_date.
ls_escalation_settings–latest_end_time = end_time.
RAISE EXCEPTION TYPE cx_grfn_msmp_configuration_err.
es_escalation_settings = ls_escalation_settings.
In MSMP stage level settings I have maintained 2 days / 48 hours as escalation time to test the enhancement.
The request has been submitted on Friday. Per standard it would escalate on Sunday. Activating the described enhancement the request escalated and moved to the next stage on Tuesday, as it is recorded in the audit log.
I think who sets escalation in the workflow customizing, will also like this enhancement.