I had the requirement to control the editability of fields on the ChaRM CRM_UI (SOLMAN 7.2) depending on the user status of the document. I found these blogs on the topic:

HowTo: User status dependent UI Control of ChaRM specific UI objects

Editability/Visibility of UI objects dependent from the user status

They were helpful but had huge holes in the information I needed to be successful at fulfilling the requirement.

I am not a CRM developer so after a lot of research, hunting and pecking, trial and error, I was able to plug the holes. In the afore listed blogs, I saw others had similar requirements as me but the responses were short on information for someone like me to be able to take the info and easily succeed. That is why I wanted to share all the details I needed.

CRM_UI

Start with the CRM_UI. Position on the field to be controlled and use F2 to get the Technical Data pop-up.

Note the Field Technical Information:

UI Component: AIC_CMCD_H
View: AIC_CMCD_H/AICCMCDHeaderEF
Context Node: BTPARTNERSET
Attribute: /AICRM/HEADER_FCT_02

Configuration Tables

To make the editability configurable by user status rather than hard coding the status in the logic these tables need to be maintained.

Tables:

AIC_UI_OBJECTS – Provide the field name. May want to use the Attribute value noted from the CRM_UI or some variation of the Attribute value. I used HEADER_FCT_02.

AIC_UI_IDT – Set the field name to a client with language specific description.

AIC_SCEN_FIELDS – Set the field name to a client with the associated assignment block (Use view AIC_PROC_EDIT3).

AICV_PROC_EDIT – Define the configuration to your transaction, field, status, etc to make it editable/executable based on your design. Make sure your entry is Active.

UI Component

Now to enhance the UI Component associated with the CRM_UI screen. This was the hardest part for me since I am not a CRM developer. I hope I provide enough information for others who are in my position and don’t have the time to figure out how to link all the required steps together.

Enter the UI Component Workbench via the Implementation Guide (txn SPRO -> SAP Reference IMG -> SAP Solution Manager Implementation Guide -> Customer Relationship Management -> UI Framework -> UI Framework Definition -> Access UI Component Workbench) or run transaction BSP_WD_CMPWB.

Enter the UI Component from the CRM_UI Technical Details (AIC_CMCD_H).

Choose Display to enter the workbench.

In the Navigation menu, expand Views.

Double click on the View name from the CRM_UI Technical Details (AIC_CMCD_H/AICCMCDHeaderEF).

Expand the Context -> Context Nodes to find the Context Node from the CRM_UI Technical Details (BTPARTNERSET).

Expand the Context Node -> Attributes to find the Attribute from the CRM_UI Technical Details (/AICRM/HEADER_FCT_02).

Expand the Attribute and double click the method you want to modify. The GET_I_* method is used to control the editability of the fields on the CRM_UI screen.

Now that you are in the GET_I_* method you need to enhance it. You do this by clicking the swirl icon.

To be able to add your code you have to show the enhancement options with Edit -> Enhancement Options -> Show Implicit Enhancements Options.

There will be 2 Enhancement Options made available. They are before the standard code and after the standard code. Position on the after option and click Create.

Choose to add Code as the type of enhancement.

Choose to Create Enhancement Implementations. (You will notice I already created an enhancement for HEADER_FCT_01 and I am creating a second enhancement for HEADER_FCT_02).

Provide a name and text for the enhancement.

Assign the enhancement to a Package.

Record the creation to a transport.

Now you can enter your code in the Enhancement area for coding. The code I used is provided below as an example. It may or may not work for others.

Enter your code, check it, activate it, and save it.

Choose to activate the Inactive Object ENHO that you just created.

The Object activates and is now usable.

Code I used

This is the code I used. This is only an example and it may or may not work for others. This code was also developed by leveraging examples. So, some of it may or may not be needed. As I mentioned, I am not a CRM developer so I did what I could to make it work for me.

This code leverages the examples provided in the blogs mentioned at the begining. It calls the method cl_wdcm_extchreq_scoping_asst=>editability_depending_on_field. That method uses the customizing tables to control the editability of the field based on user status by setting the rv_disabled field to ‘TRUE’ (not editable) or ‘FALSE’ (editable).

ENHANCEMENT Zxxx_HEADER_FCT_02.

DATA: lo_bol_col      TYPE REF TO if_bol_entity_col,

lo_req_cont     TYPE REF TO cl_crm_bol_entity,

lv_cycle_guid   TYPE crmt_object_guid,

lv_guid         TYPE crmt_object_guid,

lt_project      TYPE TABLE OF /tmwflow/projctc,

lv_process_type TYPE crmt_process_type_db,

current         TYPE REF TO if_bol_bo_property_access,

lv_bol_entity   TYPE REF TO cl_crm_bol_entity,

lo_header_bol   TYPE REF TO cl_crm_bol_entity,

lv_field        TYPE NAME_FELD,

lv_status       TYPE boolean.

lv_field = ‘HEADER_FCT_02’. “The Field Name used for table AIC_UI_OBJECTS

* By default, field configuration item is editable

rv_disabled = ‘FALSE’.

* release field read only depending on user status dependent customizing

IF iterator IS BOUND.

current = iterator->get_current( ).

lv_bol_entity ?= iterator->get_current( ).

ELSE.

current = collection_wrapper->get_current( ).

lv_bol_entity ?= collection_wrapper->get_current( ).

ENDIF.

* get header BOL

CALL METHOD cl_ai_crm_utility=>get_header_bol

EXPORTING

io_curent_bol = lv_bol_entity

IMPORTING

eo_header_bol = lo_header_bol.

TRY.

CALL METHOD lo_header_bol->get_property_as_value

EXPORTING

iv_attr_name = ‘GUID’                             “#EC NOTEXT

IMPORTING

ev_result    = lv_guid.

CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

cx_crm_genil_model_error.

RETURN.

ENDTRY.

CALL METHOD cl_wdcm_extchreq_scoping_asst=>editability_depending_on_field

EXPORTING

iv_header_guid    = lv_guid

iv_field_name     = lv_field

io_bol_header     = lo_header_bol

*        io_component      = mo_view_controller     “did not seem to be required

IMPORTING

ev_editable       = lv_status

EXCEPTIONS

parameter_missing = 1

no_document          = 2

OTHERS                     = 3.

IF sy-subrc <> 0.

rv_disabled = ‘TRUE’.

RETURN.

ENDIF.

IF lv_status NE abap_true.

rv_disabled = ‘TRUE’.                                 “#EC NOTEXT

ELSE.

rv_disabled = ‘FALSE’.                                “#EC NOTEXT

ENDIF.

ENDENHANCEMENT.

Conclusion

This example is against the Partner Function 02 but I was able to use it for the Date Attribute too. I expect it will have to expand to the Description before moving to production. I hope this helps others save hours of research and provide their organizations value.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x