Using Substatus / Status Reason / Closure Codes for ChaRM

SAP Solution Manager IT Service Management is using Substatus or Status Reason to give end-users the possibility to specify why the current status is choosen. This is a very good feature which can be used for initial status (Why transaction is created?) final status (Why transaction is closed/withdrawn?), approval and confirmation status (Why it is approved/confirmed/rejected?). The status „Sucessfully Tested“ or „Back to Development“ is also a confirmation status in this meaning.

We don’t want to discuss here, why SAP SE introduced a new concept of substatus / status reason which was already existing in SAP CRM long time ago and which is heavily used by leads, opportunities, … This is another topic which is out of scope of this post.

In this post I want to tell you how to enable this feature for Change Request Management, because it is helpful for ChaRM as well.

  1. Configuration of substatus can be done like for ITSM. No additional customizing table is needed.
  2. Substatus is available as field /AICRM/REASON_ID of table CRMD_SERVICE_H. This is true for ITSM and ChaRM. No field enhancement is needed. If we want to activate processing/change logging for this field we just have to configure it using these technical information.
  3. Substatus is available as field //BTADMINH/EXT./AICRM/REASON_ID in UI configuration of details form. This is true for ITSM and ChaRM (CR and CD). We just need to make the field visible. However ChaRM is not supporting any value help or input readiness check. This needs to be implemented (see below).
  4. Substatus is available as Search Criteria and Search Result List Field. This is true for ITSM and ChaRM (CR and CD). We just need to make the field visible. However ITSM and ChaRM are not supporting any value help (search criteria) and key to text conversion (result list field). This needs to be implemented (see below).
  5. We still have the issue, that the status change is performed by ppf actions in ChaRM. Therefore we have no chance to maintain the substatus / status reason /closure code on change to a final status, because the transaction is final after status change. Only a popup solution can help here which will need a medium-size development (see linked document).

Full Documentation: ChaRM Substatus.pdf


To enable value help and input readiness check, we need to implement all relevant getter and setter methods of AIC_CMCR_H/AICCMCRHeaderEF-BTADMINH./AICRM/REASON_ID and AIC_CMCD_H/AICCMCDHeaderEF-BTADMINH./AICRM/REASON_ID. To avoid copy past of source code we can alternatively change the inheritance hierarchy. 1. Enhance context node controller of AIC_CMCR_H/AICCMCRHeaderEF-BTADMINH and AIC_CMCD_H/AICCMCDHeaderEF-BTADMINH. 2. Exchange super class CL_SRQM_H_BTADMINH_CN by CL_AIC_INCI_INCIDENTHEADE_CN03. 3. Modify or replace code of method CL_AIC_INCI_INCIDENTHEADE_CN03->IF_BSP_MODEL~INIT and catch exception if cast of owner fails.

 METHOD if_bsp_model~init.

    CALL METHOD super->if_bsp_model~init
    EXPORTING
      ID    = ID
      owner = owner.

*We are reusing BTBadminH Context Node of Incident for Change Request and Documents.
*In this case the cast will fail because of the wrong view controller class.
*We dont need a working solution in this case. Therefore we just need to catch the exception.
    CATCH SYSTEM-EXCEPTIONS MOVE_CAST_ERROR = 1.
    mo_controller ?= owner.
    ENDCATCH.

    EXIT. "needed if this is an enhancement at the beginning of the method instead of a modification.

  ENDMETHOD.

To implement a value help for the Status Reason search criteria, we have to implement method GET_V_/AICRM_REASON_ID for view controller of AIC_CMCD_S/SearchQueryView and AI_CMCR_S/CMSR with following content:

METHOD get_v_/aicrm/reason_id.

  DATA:
    lt_list_proc_type  TYPE crmt_process_type_tab,
    lt_range_proc_type TYPE RANGE OF crmt_process_type,
    ls_range_proc_type LIKE LINE OF lt_range_proc_type.

  FIELD-SYMBOLS:
    <fv_proc_type> LIKE LINE OF lt_list_proc_type.


* Get all relevant process types (see value help getter for process_type)
  me->get_all_proc_type( IMPORTING et_proc_type = lt_list_proc_type  ).
*  lt_list_proc_type = me->get_all_proc_type( ).

*Build select option.
  LOOP AT lt_list_proc_type ASSIGNING <fv_proc_type>.
    ls_range_proc_type-sign = 'I'.
    ls_range_proc_type-option = 'EQ'.
    ls_range_proc_type-low = <fv_proc_type>.
    APPEND ls_range_proc_type TO lt_range_proc_type.
  ENDLOOP.

*Get all possible entries.
  SELECT DISTINCT reason_id AS key txt30 AS value
    INTO CORRESPONDING FIELDS OF TABLE cs_result-ddlb_options
    FROM aic_stat_reasont
   WHERE spras = sy-langu AND
         reason_id IN ( SELECT reason_id
                          FROM aic_stat_reason
                         WHERE user_stat_proc IN ( SELECT user_stat_proc
                                                     FROM crmc_proc_type
                                                    WHERE process_type IN lt_range_proc_type ) )
   ORDER BY reason_id.

*Add empty line.
  APPEND INITIAL LINE TO cs_result-ddlb_options.

ENDMETHOD.

To implement a key to text conversion for the Status Reason result list field, we have to implement method GET_/AICRM_REASON_ID for context node controller of AIC_CMCD_S/SearchQueryView-BTADMINH and AI_CMCR_S/CMSR-BTADMINH with following content:

METHOD get_/aicrm/reason_id.

  DATA: lr_current TYPE REF TO  if_bol_bo_property_access,
        lv_key     TYPE         aic_reasonid.

*Get entity.
  IF iterator IS BOUND.
    lr_current = iterator->get_current( ).
  ELSE.
    lr_current = collection_wrapper->get_current( ).
  ENDIF.

*Get key.
  lv_key = lr_current->get_property_as_string( iv_attr_name = '/AICRM/REASON_ID' ).

*use key as value if text cannot be found.
  value = lv_key.

*Try to find text.
  SELECT SINGLE txt30
    INTO value
    FROM aic_stat_reasont
    WHERE reason_id = lv_key AND
          spras = sy-langu.

ENDMETHOD.

Full Documentation: ChaRM Substatus.pdf