HowTo: User status dependent UI Control of ChaRM specific UI objects
Version 1 (without feedback yet)
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).
The following ChaRM specific UI objects are supported for user status dependent UI control for the following transaction types, sorted by assignment block:
The entries marked have a UI control assigned. I will further down explain how to implement your own UI control class.
How to create your own UI control class.
- Create your own class f.e. ZCL_AUI_CONTROL_<***. block>
- 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
- Now you have already the standard code inherited.
- The relevant method is IF_AIC_AREA_CONTROL~DEFINE_EDIT_VISIBILITY.To add your code, there are some options via the Basis Enhancement Framework:
- 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
- Implement a PostExit – Copy the standard code and adapt it to your liking
- Overwrite-Exit – add code to change the output parameters of the methd
- The choice depends on what you want to accomplish
- 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
- 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
Create an enhancement:
Type in to your liking…
Choose the type of enhancement…
The enhancement has been created:
Click on the marked place to access the coding place.
Tips and Tricks for coding in Method IF_AIC_AREA_CONTROL~DEFINE_EDIT_VISIBILITY
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):
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
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.
Here, we call the process type from the BOL
CALL METHOD io_bol_header->get_property_as_value
iv_attr_name = ‘PROCESS_TYPE’ “#EC NOTEXT
ev_result = ls_orderadm_h–process_type.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error