Skip to Content
Author's profile photo Michael Vollmer

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

Version 1 (without feedback yet)

Introduction:

Starting ST 7.10, SP5, in the area Change Management Request a new UI object control is introduced and functional available Depending from transaction type and user status specific, UI object visibility and editability can be controlled via table entries. Additionally it is possible to create your own UI control class and implement your own code (see further down).

UI control 1.jpg

The following ChaRM specific UI objects are supported for user status dependent UI control for the following transaction types, sorted by assignment block:

UI control 3.jpg

The entries marked have a UI control assigned. I will further down explain how to implement your own UI control class.

UI control 2.jpg

How to create your own UI control class.

  1. Create your own class f.e. ZCL_AUI_CONTROL_<***. block>
  2. When you copy the standard transaction type with the copy functionality to your customer transaction type, these entries are already copied, too. Check if for the relevant standard transaction type already a UI control class has been assignd. If yes, your class should inherit from it. If no, inherit from class CL_AIC_UI_CONTROL_BASE which is the base class for UI control
  3. Now you have already the standard code inherited.
  4. The relevant method is IF_AIC_AREA_CONTROL~DEFINE_EDIT_VISIBILITY.To add your code, there are some options via the Basis Enhancement Framework:
    1. Implement a PreExit – You can copy the standard code into it and change it and add a return, so the normal code will not be run through
    2. Implement a PostExit – Copy the standard code and adapt it to your liking
    3. Overwrite-Exit – add code to change the output parameters of the methd
  5. The choice depends on what you want to accomplish
  6. Be aware that after each upgrade in SPAU_ENH, the object has to be checked. The standard code might change and you might want to adapt
  7. Last but not least enter the UI object class in the IMG activity as visible in the screenshot above for your transaction type and user status

Creating Basis Enhancements:

Here is some more detail how to use the Basis Enhancement Framework in SE24:

Go into the class in SE24

enhance 3.jpg

Create an enhancement:

enhance 1.jpg

Type in to your liking…

enhance 2.jpg

Choose the type of enhancement…

Enhance 4.jpg

The enhancement has been created:

enhance 5.jpg

Click on the marked place to access the coding place.

Tips and Tricks for coding in Method IF_AIC_AREA_CONTROL~DEFINE_EDIT_VISIBILITY

/wp-content/uploads/2012/06/interface_115005.jpg

The interface hands over:

  • GUID of the document (IV_GUID)
  • The reference to the BOL header (from which you can access every current data in the document, each assignment block (IO_BOL_HEADER)
  • The UI component class (IO_COMPONENT)
  • The importing parameters of the customizing for the control class (IS_UI_CONTROL):

Fields

MANDT                      client

PROCESS_TYPE     transaction type

FIELDNAME             UI object ID

STSMA                     user status profile

USER_STATUS       user status

EDITABLE               UI object is editable

MANDATORY         do not use

VISIBLE                   UI object is visible

CLASS                     assigned UI control class

METHOD                 called UI control class method

ACTIVE                   customizing entry is active

  • The UI object ID (IV_FIELDNAME)
  • The exporting parameter of the UI object customizing (ES_UI_CONTROL, same fields as IS_UI_CONTROL)

ES_UI_CONTROL is the important one to change, especially fields EDITABLE and VISIBLE.

Tips and Tricks to program in method IF_AIC_AREA_CONTROL~DEFINE_EDIT_VISIBILITY

Some example code from class

METHOD if_aic_area_control~define_edit_visibility.

METHOD if_aic_area_control~define_edit_visibility.

  DATA:         lv_project_id   TYPE project_id,

                lt_context      TYPE STANDARD TABLE OF tsocm_cr_context,

                ls_orderadm_h   TYPE crmt_orderadm_h_wrk.

  DATA: ls_proxy        TYPE tsocm_proxy_impl.

  DATA: lv_project_cr   TYPE project_id.

  DATA: lv_non_smcg     TYPE flag.

  DATA: l_doc_flow_tab  TYPE crmt_doc_flow_wrkt.

  FIELD-SYMBOLS: <fs_context> TYPE tsocm_cr_context.

  es_ui_control = is_ui_control.

  CHECK iv_fieldname = cl_wdcm_extchreq_scoping_asst=>c_project_id OR  

” the constants of the UI objects can be found in class cl_wdcm_extchreq_scoping_asst or class cl_ai_crm_action_utility

        iv_fieldname = cl_wdcm_extchreq_scoping_asst=>c_ibase_component.

* read project id

  lv_project_id = cl_al_crm_cm_utility=>read_project_id( iv_guid ).

  IF iv_fieldname EQ cl_wdcm_extchreq_scoping_asst=>c_project_id.

    TRY.

Here, we call the process type from the BOL

        CALL METHOD io_bol_header->get_property_as_value

          EXPORTING

            iv_attr_name = ‘PROCESS_TYPE’                   “#EC NOTEXT

          IMPORTING

            ev_result    = ls_orderadm_hprocess_type.

      CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

            cx_crm_genil_model_error.

        RETURN.

    ENDTRY.

  ENDIF.

.

.

.

.

ENDMETHOD.

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Michael,

      this is quite helpful.

      Where can the list "ChaRM specific UI objects that are supported for user status dependent UI control for transaction types, sorted by assignment block" be found in the documentation / help file / config guide?

      Thanks & regards

      Winfried

      Author's profile photo Michael Vollmer
      Michael Vollmer
      Blog Post Author

      Hi Winfried, that is directly from the IMG activity, reworked coming SP7 😉

      Author's profile photo Former Member
      Former Member

      Hi Michael:   Many thanks for the help.  Excuse my ignorance I am not familiar with the programming side anad probably what I am about to write may be all controllable by a  class name or method.  The question is:  can we add new UI Objects to the table  AICV_PROC_EDIT that has the list of UI objects delivered by SAP?   There is a limitation in the list of UI Objects we can use, and we would like to take advantage of this feature to make various of our new fields display only after a phase change, but to accomplish that we need to be able to add them all here.     

      Author's profile photo Michael Vollmer
      Michael Vollmer
      Blog Post Author

      Hi Juan,

      in general, you could enter new Z/Y named objects, sure. But you have to implement the reading and checking method for your field for yourself. And please be aware that SAP cannot take over responsibility if they change something in the reading method and it's not working for you anymore. It's not an official open Framework, here. It's a customer enhancement. So, maybe it would make more sense, to copy the method to a customer class, so you have it under your control. As long as you enter fields starting with Z and Y this should be fine. If I remember correctly, there is a check table behind, meaning your entry has to be entered there as well.

      The reading method is

        cl_wdcm_extchreq_scoping_asst=>editability_depending_on_field(

          EXPORTING

            iv_header_guid    = iv_header_guid

            iv_field_name     = cl_wdcm_extchreq_scoping_asst=>c_appr_crit_obj

          IMPORTING

            ev_editable       = lv_edit

            ev_visible        = lv_visible

          EXCEPTIONS

            parameter_missing = 1

            no_document       = 2

            OTHERS            = 3 ).

        IF sy-subrc <> 0.

      *    This should never happen

      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

          lv_edit = abap_false.

        ELSE.

        ENDIF.

      Best regards,

      Michael

      Author's profile photo Former Member
      Former Member

      Many thanks for the reply Michael.  Very useful.

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      as usual it's a very good detailed information, and I am glad SAP added this type of control of visibility for UI objects.

      Question I have though:

      for Incident Management - I need the "Create follow-up" button in ZMIN to be not-editable when ZMIN is in status "Confirmed",

      but I cannot see UI objects for this button available in this configuration.

      Is there a way to configure this ?

      Thanks a lot

      Elena

      Author's profile photo Michael Vollmer
      Michael Vollmer
      Blog Post Author

      Hi Elena,

      unfortuantely incident management does not use this feature. I would expect you have to create an enhancement (overwrite the method

      CL_AIC_INCI_INCIDENTOV_IMPL, method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS where the buttons are created) and check in the code for the FINI status of the document and if not set the 

      ls_button-enabled struture for the 'Create follow-up' button to false.

      hope that helps,

      Michael

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      I was trying to enable the UI Element "REASSIGN" to enable the functionallity of reassigning/changing the Project for General changes at status "In Development"

      As suggested by you in this blog  i have done the setings i.e. added ui element for ZMCG in Adjust UI objects by user status and made it active but still in CRM UI the option "change project assignment" is disabled.

      Please let me know is there any additional settings i need to do also suggests that if  we have a CR with one change document (let’s say a GC) and that GC is “In Development” we could reassign that GC to another project and it would also move the CR to that project as long as certain criteria are met.

      Please let me know how to enable that ability, and what role would have that ability if we ever wanted to use it.

      Thanks & Regards

      Z

      Author's profile photo Former Member
      Former Member

      We have defined a field as "Approver" using UI object ID HEADER_FCT_10. I have tried many combinations of Control Classes (including a "Z" class) Control Methods and debugging (using DO-ENDOs and SM50) and I cannot get custom field referenced using UI element HEADER_FCT_10. In debug, I can see PROJECT_ID and SCOPE, the only other 2 UI elements we currently are controlling. Is there any special configuration for a user define UI element?  

      Thanks and regards,

      William

      Author's profile photo Michael Vollmer
      Michael Vollmer
      Blog Post Author

      Hi William,

      you are correct, the field HEADER_FCT_10 is not supported. You would need to enhance the editable control method GET_I_/AICRM/HEADER_FCT_10 in the view AIC_CMCR_H/AICCMCRHeaderEF  with the method call of cl_wdcm_extchreq_scoping_asst=>editability_depending_on_field as described above.

      Maybe set a break-point there to further analyse.

      Hope that helps,

      Michael

      Author's profile photo Former Member
      Former Member

      Hi William,

      Hi Michael,

      I have the same requirement.

      I don't understand the solution of Michael. Method GET_I_/AICRM/HEADER_FCT_10 is SAP standard and cannot be changed.


      How did you solve this issue?


      Best regards,

      Eva

      Author's profile photo Michael Vollmer
      Michael Vollmer
      Blog Post Author

      Hi Eva,
      You can change the method by creating an enhancement project for the UI component or by using the basis enhancement  Framework,
      best regards,
      Michael