Change Editability of Multi Level Categorization fields (tcode SM_CRM)
In the Request for Change (ZMCR), I have configured the Approval Procedure to be determined by Multi Level Categorization. When the ChaRM status is in “To Be Approved”, it does not make sense to allow the Categorization to be changed since the Approver Procedure might also change. So, I had the requirement to protect the Categorization fields from changes when the status is “To Be Approved”. The IMG activity “Adjust UI objects by User Status” does not offer the Categorization fields for selection, so I needed to make the change in an Enhancement.
The following screen shots are from 7.1 SP11.
In ZMCR, put the cursor on the Category field and select F2. Locate the UI Component name and View.
In tcode BSP_WD_CMPWB, enter the component name and Display…
Navigate to the Attributes in the Context Nodes and locate GET_I_CAT01 for the first Categorization field. If the logic is needed for the other Categorization fields, these changes can also be applied to GET_I_CAT02, GET_I_CAT03, and so on….
Create a new Enhancement in each GET_I_CATxx method as needed. Here’s my code…
method get_i_cat01.
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””$”$\SE:(1) Class CL_BTCATEGO_CATEGORIES_CN00, Method GET_I_CAT01, Start A
*$*$-Start: (1)———————————————————————————$*$*
ENHANCEMENT 1 Zxxx_CHARM_CATEGORIZATION_1. “active version
************************************************************************************
************************************************************************************
data: ls_continue(1).
CALL METHOD Zxxx_CHARM=>SET_EDITABILITY_CATEGORIZATION
EXPORTING
PI_FIELD_SETTING = cat01_input_ready
IMPORTING
PO_RETURN = rv_disabled
PO_CONTINUE = ls_continue.
if ls_continue ne ‘X’. “continue with standard logic?
exit.
endif.
ENDENHANCEMENT.
*$*$-End: (1)———————————————————————————$*$*
rv_disabled = ‘TRUE’.
if cat01_input_ready eq abap_true.
rv_disabled = ‘FALSE’.
endif.
endmethod.
method SET_EDITABILITY_CATEGORIZATION.
* Parameters are:
* PI_FIELD_SETTING TYPE CRMT_BOOLEAN “Logical Variable
* PO_RETURN TYPE STRING ” Editability status
* PO_CONTINUE TYPE CHAR1 ” =X if standard should be processed
DATA: ls_HEADER_GUID TYPE CRMT_OBJECT_GUID,
ls_STATUS_CODE TYPE CRM_J_STATUS,
ls_STATUS_TEXT TYPE CHAR30,
LS_PROCESS_TYPE type CRMT_PROCESS_TYPE_DB.
PO_CONTINUE = ‘X’. “default to process standard logic
* 1) Read ChaRM guid
CALL FUNCTION ‘CRM_INTLAY_GET_HEADER_GUID’
IMPORTING
ev_header_guid = ls_HEADER_GUID.
* 2) Process only for ZMCR. If it is not, continue with original processing.
select single process_type from crmd_orderadm_h INTO LS_PROCESS_TYPE
WHERE guid = ls_HEADER_GUID.
if sy-subrc = 0
and LS_PROCESS_TYPE = ‘ZMCR’.
* 3) Read ChaRM status
CALL METHOD Zxxx_CHARM=>READ_CHARM_STATUS
EXPORTING
PI_GUID = ls_HEADER_GUID
IMPORTING
PO_STATUS_CODE = ls_status_code
PO_STATUS_TEXT = ls_status_text. “not used here
* 4) Check if pending approval. If it is not, continue with original processing.
* The sequence for this was determined by watching in debug.
* This will set the field to display only when in edit mode.
if ls_status_code = ‘E0012’.
po_return = ‘FALSE’.
if pi_Field_setting eq abap_true.
po_return = ‘TRUE’.
endif.
clear PO_CONTINUE. “skip standard logic
endif.
endif.
endmethod.
Fields are now display only when in status ‘To Be Approved;….
Hi Robyn
Thanks for sharing.
Regards
Rishav
Hi.
Thanks for sharing this article. Very usefull content.
One question, I did not see this IMG activity on my CRM: "The IMG activity "Adjust UI objects by User Status" does not offer the Categorization fields for selection, so I needed to make the change in an Enhancement."
Can you send me the full path to this IMG transaction please?
Thanks.
Hi Susana,
Sorry for the delayed response. I've been on vacation.
On SP13, the IMG path to "Adjust UI Objects by User Status" is SAP Solution Manager -> Capabilities (Optional) -> Change Control Management -> Change Request Mangement Framework -> Adjust UI Objects by User Status.