This enhancement is required to connect the Dynamic Work Centre with the standard BPEM functionality provided by SAP and/or the Assignments History feature of both the DWC and BDEx Customer-centric Hub. It is essential that this enhancement catches and maintains the underlying BWC database tables in line with updates to the EMMA Case Header fields and assignments changes otherwise the DWC and/or the Assignments History feature will become disconnected from the work routed to agents.
Since SAP has built their BPEM Solution to allow for Cases to be created manually and also in batch the additional logic required to keep the BWC tables up to date requires the following Methods to be adjusted:
CREATE_CASES – Post Exit needed to ensure a new entry is added to the main BWC Work Request Header Table /BTI/MDE_BWC_WRH for each new BPEM Case being created.
Note: When called in Batch mode this Method may also be provided Agent Assignments up front which will need to be captured in the BWC Assignments table /BTI/MDE_BWC_ASN.
CHANGE_CASE – Post Exit required to modify the existing entry in the BWC table /BTI/MDE_BWC_WRH and keep it in line with any changes made to the EMMA Case header fields. If any Agent Assignment changes have occurred these will also need to be stored in the BWC Assignments table /BTI/MDE_BWC_ASN.
CHANGE_CASE_HEADER – Post Exit required to modify the existing entry in the BWC table /BTI/MDE_BWC_WRH and keep it in line with any changes made to the EMMA Case header fields. If any Agent Assignment changes have occurred these will also need to be stored in the BWC Assignments table /BTI/MDE_BWC_ASN.
CHANGE_CASE_ACTORS – Post Exit required to capture any Agent Assignment changes and cascade them to the BWC Assignments table /BTI/MDE_BWC_ASN.
DELETE_CASES – An Overwrite Exit is required to ensure database integrity and sequencing of updates to allow for the BPEM and BWC tables to be deleted in a logical order.
Method Type Description
CHANGE_CASE PostExit Update BWC Tables with new details and possibly new Processors if required
CHANGE_CASE_HEADER PostExit Update BWC Tables with new details and possibly new Processors if required
CREATE_CASES PostExit Update BWC Tables with new details and Actors
DELETE_CASES Overwrite-Exit Delete BWC Table entries in line with updates to EMMA Tables
CHANGE_CASE_ACTORS PostExit Update BWC Assignments tables
The following sample code should be used as a guide:
CLASS lcl_zbwc_emma_dbl46 DEFINITION DEFERRED.
CLASS cl_emma_dbl46 DEFINITION LOCAL FRIENDS lcl_zbwc_emma_dbl46.
———————————————————————————————————
- CLASS LCL_ZBWC_EMMA_DBL46 DEFINITION
———————————————————————————————————
*
———————————————————————————————————
CLASS lcl_zbwc_emma_dbl46 DEFINITION. PUBLIC SECTION. CLASS-DATA obj TYPE REF TO lcl_zbwc_emma_dbl46. “#EC NEEDED DATA core_object TYPE REF TO cl_emma_dbl46 . “#EC NEEDED INTERFACES: IPO_ZBWC_EMMA_DBL46, IOW_ZBWC_EMMA_DBL46. METHODS: constructor IMPORTING core_object TYPE REF TO cl_emma_dbl46 OPTIONAL.
ENDCLASS. “LCL_ZBWC_EMMA_DBL46 DEFINITION
———————————————————————————————————
- CLASS LCL_ZBWC_EMMA_DBL46 IMPLEMENTATION
———————————————————————————————————
*
———————————————————————————————————
CLASS lcl_zbwc_emma_dbl46 IMPLEMENTATION. METHOD constructor. me->core_object = core_object. ENDMETHOD. “CONSTRUCTOR METHOD iow_zbwc_emma_dbl46~delete_cases. “———————————————————————————————————— *” Declaration of Overwrite-method, do not insert any comments here please! *” *“methods DELETE_CASES *” importing *” !IV_EMMARUNID type EMMA_RUNID optional *” !IV_INTNR type EMMA_INTNR optional *” exceptions *” NOT_DELETED *” NOT_FOUND . “———————————————————————————————————— DATA lt_emma_case TYPE STANDARD TABLE OF emma_case WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0. FIELD-SYMBOLS: TYPE emma_case. DATA: ls_emma_hdr TYPE emma_hdr. DATA: co_obj TYPE balobj_d VALUE ‘EMMA’. DATA: co_subobj TYPE balsubobj VALUE ‘CASE’. DATA: lv_extnum TYPE balnrext. DATA: lt_emma_int TYPE STANDARD TABLE OF emma_int WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0. DATA: ls_emma_int TYPE emma_int. DATA: ls_bal_fil TYPE bal_s_lfil, lt_extnum TYPE bal_r_extn, ls_extnum TYPE bal_s_extn, lt_obj TYPE bal_r_obj, ls_obj TYPE bal_s_obj, lt_subobj TYPE bal_r_sub, ls_subobj TYPE bal_s_sub, lt_balhdr TYPE balhdr_t, ls_balhdr TYPE balhdr, ls_log TYPE bal_s_log, ls_data TYPE emma_case, ls_context TYPE emma_case_context, lt_loghandle TYPE bal_t_logh, lv_biw TYPE boole_d, ls_biw TYPE biw_emma_case, lt_biw TYPE TABLE OF biw_emma_case, lv_wr_key TYPE /bti/mde_de_wr_key.
- update EMMA_HDR and EMMA_INT only as long as classic EMMA is still calling method SELECT SINGLE * FROM emma_hdr INTO ls_emma_hdr WHERE runid = iv_emmarunid.
- read all intervals SELECT * INTO TABLE lt_emma_case FROM emma_case WHERE runid = iv_emmarunid. ELSE. SELECT * INTO TABLE lt_emma_case FROM emma_case WHERE runid = iv_emmarunid AND intnr = iv_intnr.
- read only one interval ENDIF. IF sy-subrc <> 0. IF ls_emma_hdr-version < cl_emma_job=>co_version_5.
- update EMMA_HDR and EMMA_INT only as long as classic EMMA is still calling method UPDATE emma_hdr SET emma_case = 0 cgen_status = ‘0’ WHERE runid = iv_emmarunid. UPDATE emma_int SET emma_case = 0 cgen_status = ‘0’ WHERE runid = iv_emmarunid. ENDIF. RAISE not_found. ENDIF.
- don’t delete manual cases IF ls_emma_hdr-emma_jobrustatus = ‘4’. “cl_emma_job=>co_job_status_comp_no_del. RAISE not_deleted. ENDIF.
- all cases need to be in status NEW or CANCELLED LOOP AT lt_emma_case ASSIGNING . CHECK -status NE cl_emma_case=>co_status_new AND -status NE cl_emma_case=>co_status_canc. RAISE not_deleted. ENDLOOP.
- Update the BWC tables to cancel any deleted cases. lv_wr_key = -casenr.
- update EMMA_HDR and EMMA_INT only as long as classic EMMA is still calling method UPDATE emma_hdr SET emma_case = 0 cgen_status = ‘0’ WHERE runid = iv_emmarunid. UPDATE emma_int SET emma_case = 0 cgen_status = ‘0’ WHERE runid = iv_emmarunid. ENDIF.
- check if DataSource 0FCEMMA_CASE is initialized SELECT initstate FROM roosprmsc INTO lv_biw WHERE oltpsource = cl_emma_case=>co_datasource AND initstate = cl_emma_case=>co_true. EXIT. ENDSELECT. IF lv_biw = cl_emma_case=>co_true. “DataSource initialized
- add delete records to delta table LOOP AT lt_emma_case ASSIGNING . -changed_date = sy-datum. -changed_time = sy-uzeit. -changed_by = sy-uname.
- fill deltaqueue table for BW MOVE-CORRESPONDING TO ls_biw.
- add business process area IF NOT -bpcode IS INITIAL. SELECT SINGLE bparea FROM emma_bpc INTO ls_biw-bparea WHERE bpcode = -bpcode. ENDIF.
- draw new GUID CALL FUNCTION ‘GUID_CREATE’ IMPORTING ev_guid_16 = ls_biw-delta.
- mark case as deleted ls_biw-updmode = ‘D’. APPEND ls_biw TO lt_biw. ENDLOOP.
- insert BW delta records INSERT biw_emma_case FROM TABLE lt_biw. ENDIF.
- try to find the existing action log for the cases
- build ranges EXTERNAL_NUMBER CLEAR ls_extnum. ls_extnum-sign = ‘I’. ls_extnum-option = ‘EQ’. ls_extnum-low = iv_emmarunid. APPEND ls_extnum TO lt_extnum.
- build ranges OBJECT CLEAR ls_obj. ls_obj-sign = ‘I’. ls_obj-option = ‘EQ’. ls_obj-low = co_obj. APPEND ls_obj TO lt_obj.
- build ranges SUBOBJECT CLEAR ls_subobj. ls_subobj-sign = ‘I’. ls_subobj-option = ‘EQ’. ls_subobj-low = co_subobj. APPEND ls_subobj TO lt_subobj.
- build filter structure CLEAR ls_bal_fil. ls_bal_fil-extnumber = lt_extnum. ls_bal_fil-object = lt_obj. ls_bal_fil-subobject = lt_subobj.
- Retrieve the latest case actors SELECT * FROM emma_cactor INTO CORRESPONDING FIELDS OF TABLE lt_actors WHERE casenr = cs_case-casenr.
- Update the BWC tables CREATE OBJECT lr_db.
- Need most up to date version of case, so retrieve from db instead of using ir_case lr_case = core_object->read_case_detail( ls_data-casenr ). ls_data = lr_case->get_data( ).
- Use this data to update BWC tables CREATE OBJECT lr_db. CALL METHOD lr_db->load_from_bpem EXPORTING is_case = ls_data is_dbcase = ls_dbdata it_actors = lt_act RECEIVING rr_bwc_wr = lr_wr.
- Need most up to date version of case, so retrieve from db instead of using ir_case lr_case = core_object->read_case_detail( ls_data-casenr ). ls_data = lr_case->get_data( ). lt_act = lr_case->get_actors( ).
- Use this data to update BWC tables CREATE OBJECT lr_db. CALL METHOD lr_db->load_from_bpem EXPORTING is_case = ls_data it_actors = lt_act RECEIVING rr_bwc_wr = lr_wr.
ENDMETHOD.
ENDCLASS.
Post your comment on this topic.