CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
bruce_li
Contributor

If you have issues when you try to do "delete", "Assign To", "Route To", "Forward", "Set to Complete" in Email Workbench(see following screen), where we can start to do the debugging. What is the important table for these actions. Where to understand the standard logic. Please check following information.

useful method and table to analyze and debug with

1.Methods:

1-1.Method IF_CRM_ERMS_WB_ACTION~EXECUTE of following classes:

CL_CRM_ERMS_WB_ACT_COMPLETE    Action: Set E-Mail Status to Complete

CL_CRM_ERMS_WB_ACT_DELETE      Action: Delete

CL_CRM_ERMS_WB_ACT_FORWARD     Action: Forward

CL_CRM_ERMS_WB_ACT_REASSIGN    Action: Reassign E-Mail

CL_CRM_ERMS_WB_ACT_ROUTE       Action: Action Route

1-2. Following methods is a great start points when debugging "delete, route, reassign, set to complete, forward" issues in E-mail workbench.


Method DO_HANDLE_EVENT of following classes:
CL_CRMCMP_E_EMAILWBSR_IMPL
CL_CRMCMP_E_EMAILWBSR


2.Table:

crmc_ic_auicomm (You can edit the table by customizing: spro->Customer Relationship Management-> Interaction Center WebClient-> Agent Inbox-> Settings for Asynchronous Inbound Processing-> Assign Standard Tasks to Communication Methods)

Further Explanation

1. Table crmc_ic_auicomm is very important, the standard entries of this table is as following:

(customizing: spro->Customer Relationship Management-> Interaction Center WebClient-> Agent Inbox-> Settings for Asynchronous Inbound Processing-> Assign Standard Tasks to Communication Methods)

Wrong entries in this table crmc_ic_auicomm always lead to the problem when you execute "delete", "Assign To", "Route To", "Forward", "Set to Complete" in Email Workbench. Like the problem mentioned SAP KBA:2148197 - Error “E-mail with subject has status Completed; action cannot be performed” when routing ....

Actually, the issue in above KBA 2148197 is due to a wrong entry "207915 INT" added in table crmc_ic_auicomm. Actually, if you know the useful methods I listed on the top, you will be able to easily find the cause by debugging. I will use the problem in this KBA as an example and explain further about how to analyze by debugging by following.

2. Trouble shooting by debugging or view the code of the method.


Before we start, let‘s check something about ERMS mails. As we know, when an ERMS mail comes into CRM, there will be 3 workitem steps generated which are Dialog step, Background Step and (Sub)workflow step. And for the backgroud step, after invoke ERMS service manager is finished, the status will be changed to completed. In another words, once you can find inbound Emails in WebUI, this backgound steps is already completed. You can check it easily in T-code: SWI1. (see screenshot below)

Then you can set breakpoint in method IF_CRM_ERMS_WB_ACTION~EXECUTE of CL_CRM_ERMS_WB_ACT_ROUTE which I mentioned on the top. If you don't know this method, you can set breakpoint in Method DO_HANDLE_EVENT of classes:CL_CRMCMP_E_EMAILWBSR_IMPL or CL_CRMCMP_E_EMAILWBSR, later you will go to route method.

Then we try to route or assign the relevant email(status: in Queue) but we see the error "E-mail with subject has status Completed; action cannot be performed" although the status of the E-Mail is not completed.


During debug,

2-1. You will find system will first set the valid statuses as “Ready”, “SELECTED” and “STARTED” into internal table lr_valid_statuses.

=>

*-- Set the valid statuses

  ls_valid_status-option = 'EQ'.

  ls_valid_status-sign = 'I'.

  ls_valid_status-low = 'READY'.

  APPEND ls_valid_status TO lr_valid_statuses.

  ls_valid_status-low = 'SELECTED'.

  APPEND ls_valid_status TO lr_valid_statuses.

  ls_valid_status-low = 'STARTED'.

  append ls_valid_status to lr_valid_statuses.

=>

2-2. Then system will take all INT type task from table crmc_ic_auicomm and put them into table lr_possible_tasks.

Here we can see the task 207915 is taken into table lr_possible_tasks.

=>

*-- Get the task ID that is used as a wrapper for the e-mail

  SELECT * FROM crmc_ic_auicomm INTO lv_ic_auicomm WHERE commtype = 'INT'. "#EC CI_NOFIELD <<<<<<<

    ls_possible_task-option = 'CP'.

    ls_possible_task-sign = 'I'.

    CONCATENATE '*' lv_ic_auicomm-wftaskid INTO lv_task.

    ls_possible_task-low = lv_task.

    APPEND ls_possible_task TO lr_possible_tasks.

  ENDSELECT.

=>

2-3.During debug, we can find the error CRM_ERMS_WORKBENCH 004 "E-mail &1 with subject &2 has status &3; action cannot be performed" is thrown in following coding. We can see system will loop all depenant work items with all take types in table lr_possible_tasks which includes task 207915(see step 2-2).

As we explained earlier, for the backgroud step 207915, after invoke ERMS service manager is finished, the status will be changed to completed. In another words, once you can find inbound Emails in WebUI, this backgound steps is already completed. Then as work item ( 207915)'s "completed" status is not in lr_valid_statuses(“Ready”, “SELECTED” and “STARTED”).(see step 2-1). Then system goes below else statement, and error CRM_ERMS_WORKBENCH 004 is issued from there.

So we understand that entry "207915 INT" in table crmc_ic_auicomm is the cause. After we followed the solution in above KBA 2148197 to remove wrong entry "207915 INT", issue is resolved.

Note: the coding part from step 2-1 to 2-1 is all most the same when you execute assign and route in E-mail workbenct. But "set to complete" and "delete" is a little different, please see point 3 and 4 below.

=>

LOOP AT lt_dependant_wis INTO ls_dependant_wis WHERE wi_rh_task IN lr_possible_tasks. <<<<

    IF ls_dependant_wis-wi_stat IN lr_valid_statuses AND ls_dependant_wis-wi_disable IS INITIAL.<<<<<

-

-

-

-

    ELSE.

      IF NOT ls_dependant_wis-wi_stat IN lr_valid_statuses. <<<<<<<<<

        CREATE OBJECT ex.

        ex->set_id('004'). 《《Error CRM_ERMS_WORKBENCH 004 will be thrown here


=>

3. The logic when you click delete in E-mail workbench.


3-1.In method  CL_CRM_ERMS_WB_ACT_DELETE  IF_CRM_ERMS_WB_ACTION~EXECUTE, there is no logics to take all INT type tasks from table crmc_ic_auicomm like in above step 2-2. Or else, it will cause the issue that: You search for an e-mail using E-mail Workbench application. From the result list, you select an e-mail and then click on the button 'Delete' to delete the same. You observe that only the Dialog step workitem gets deleted from the table SWWWIHEAD and the other two steps  (Background and (Sub)workflow) are not deleted.

The below correction is done by SAP Note: 1668579 - E-mail WB: E-mail deletion only deletes the Dialog step. Following coding is deleted.

*>>>> START OF DELETION <<<<<
*-- Find dependant wis
  CALL FUNCTION 'SWW_WI_FIND_DEPENDANT_WIS'
    EXPORTING
      wi_id                        = ls_father_wis-wi_id
*   STATUS                       =
*   DIRECT_DEPENDANTS_ONLY       = 'X'
    TABLES
      dependent_wis                = lt_dependant_wis.

*-- Get the task ID that is used as a wrapper for the e-mail
  SELECT * FROM crmc_ic_auicomm INTO lv_ic_auicomm WHERE commtype = 'INT'."#EC CI_NOFIELD
    ls_possible_task-option = 'CP'.
    ls_possible_task-sign = 'I'.
    CONCATENATE '*' lv_ic_auicomm-wftaskid INTO lv_task.
    ls_possible_task-low = lv_task.
    APPEND ls_possible_task TO lr_possible_tasks.
  ENDSELECT.

LOOP AT lt_dependant_wis INTO ls_dependant_wis WHERE wi_rh_task IN lr_possible_tasks.

ENDLOOP.

   IF ls_dependant_wis-wi_id is not initial.
      call function 'SWW_WI_DELETE' DESTINATION 'NONE'
        exporting
          wi_id               = ls_dependant_wis-wi_id
*>>>> END OF DELETION <<<<<<<

3-2. E-mail  has the status Completed/Deleted cannot be deleted. This is done by following method

CL_CRMCMP_E_EMAILWBSR_IMPL==== / CL_CRMCM
METHOD          / EH_ONDELETE (CL_CRMCMP_

IF lv_status NE CV_STATUS_COM AND lv_status NE CV_STATUS_DEL. <<<<<<<<

CV_STATUS_COM                                     COM
CV_STATUS_DEL                                     DEL


ELSE.  <<<<<<<<<<<<<<<<
* Sent confirmation system message.

        lr_msg_srv = me->view_manager->get_message_service( ).
        lr_msg_srv->add_message(    iv_msg_type    = 'I'      <<<<<<<<<<<<<<<<<<<<<<
                                     iv_msg_id     = 'CRM_RO'
                                     iv_msg_number = '018' ).


CRM_RO 018 Selected Email has the status Completed/Deleted which cannot be deleted.

4. The logic when you click complete button to set your mail to complete in E-mail workbench.

The following logic in Method   IF_CRM_ERMS_WB_ACTION~EXECUTE of CL_CRM_ERMS_WB_ACT_COMPLETE is special. Only the workitem is not in status "Ready", "SELECTED","STARTED",  "COMPLETED", "CANCELED", "'ERROR" OR "COMMITED", SYSTEM will issue error message CRM_ERMS_WORKBENCH 004:"E-mail &1 with subject &2 has status &3; action cannot be performed". This is controlled by following coding.


=>

LOOP AT lt_dependant_wis INTO ls_dependant_wis WHERE wi_rh_task IN lr_possible_tasks.

    IF ls_dependant_wis-wi_stat IN lr_valid_statuses AND ls_dependant_wis-wi_disable IS INITIAL.

-

-

-

-

ELSE.



      IF NOT ls_dependant_wis-wi_stat IN lr_valid_statuses.

*-- Some final statuses, we just want to update the reporting tables.

        CASE ls_dependant_wis-wi_stat.

          WHEN 'COMPLETED' OR 'CANCELED' OR 'ERROR' OR 'COMMITED'. <<<<<<<<<<<<

            CALL FUNCTION 'CRM_ERMS_RPT_EVENT_HANDLER'

              EXPORTING

                event_id        = 'MCO'

                connection_id   = lv_con_id

*               EXT_ADDRESS     =

*               INT_ADDRESS     =

*               FIRST_ORG_UNIT  = lv_header-org_unit

*               SECOND_ORG_UNIT = lv_new_org_unit

                first_agent     = lv_header-resp_agent

                second_agent    = lv_new_agent

*               EMAIL_TIMESTAMP =

                from_icwc       = space

*               WEBFORM_ID      =

*               CASE_ID         =

*               SERVICE_ID      =

*               WORKITEM_ID     =

              .



          WHEN OTHERS. <<<<<<

            CREATE OBJECT ex.

            ex->set_id('004'). <<<<

=>