Step by Step SAP CRM ACE Configurations for ‘new’ Super Object -> Object
Many times we have requirement to restrict access through ACE (Access Control Engine) but the related object seems not to be available in Super object type. For example I have requirement to activate ACE for Product Category but the super object is not available in SAP CRM 7.3
Details for Super Object:
So I had to make a new ACL, GRP and UCT tables and Extension class. I have copied ACL, GRP and UCT tables from PRODUCT super object entry and make three new DDIC tables (no extra fields are required as these tables have similar structure through all Super object). I have coped extension class from ACCOUNTCRM super object entry. Please find below code snippet from method IF_CRM_ACE_OTYPE_OF_GUIDS~GET_OTYPE_OF_GUIDS extension class:
lwa_guid_with_otype TYPE crms_ace_objs_with_type.
<ls_obj_guid> TYPE crms_ace_object_guid.
lc_crm_super_type TYPE crmt_prt_otype
*=> copy imported as long as there is no otype determination support
* for the stype
LOOP AT it_object_guids ASSIGNING <ls_obj_guid>.
lwa_guid_with_otype–object_type = lc_crm_super_type.
lwa_guid_with_otype–is_bor_otype = space.
lwa_guid_with_otype–object_guid = <fs_obj_guid>–object_guid.
*=> add object guid with CRM object type to result list
APPEND ls_guid_with_otype TO et_otype_of_guids.
I had selected PRODUCTCATEGORYCRM as Super Object and configured relevantly.
Details for Object:
I had chose same PRODUCTCATEGORYCRM as Object to configure with Super Object. Identification Type is GUID and a new Info class id, Info class ID is representation with class copied from CL_CRM_ACE_PR_INFO_DEFAULT. In IF_CRM_ACE_DETAILS~GET_DETAILS method code must be written to select GUID from ID and ID from GUID (similar coding from GET_OBJECTS_BY_FILTER of AFO class).
Other Configuration for AFO, OBF and AFU class are same for other ACE implementation and can be found from other class.
Challenge and calling ACE:
When SAP Standard has the Super Object type not available then ACE is not called automatically through SAP Standard code (generally in FILTER method).
Solution would be either Enhance ONSEARCH event handler or GENIL class enhancement for Serach, I have chosen GENIL class enhancement as it would be called from all search functionality! what ever after getting the search result below code should be called with GUID entries:
Call ACE Runtime methodes
CALL METHOD cl_crm_ace_runtime=>check_multiple_objects_guid
im_object_type = ‘PRODUCTCATEGORYCRM’
ch_object_guids = li_ace_guids.
CATCH cx_crm_ace_unsupported_action .
* Check the filtered results
LOOP AT li_hier_select INTO lwa_hierarchy_selection.
READ TABLE li_ace_guids TRANSPORTING NO FIELDS WITH KEY object_guid = lwa_hierarchy_selection–hierarchy_guid.
IF sy–subrc NE 0.
DELETE li_hier_select WHERE hierarchy_guid = lwa_hierarchy_selection–hierarchy_guid.
SORT li_hier_select BY hierarchy_id.
Hope it would be helpful to all who are struggling, if you have questions or comment please add it! 🙂
In Class CL_CRM_ACE_USER_OBJECTS_CACHE method CHECK_MULTIPLE_OBJECTS_BY_ACL you can check for ACL table selection and analyze filtered output.