Enhancement of The User Interface Building Block For Change Requests
Enhancement of The User Interface Building Block For Change Requests
TABLE OF CONTENTS
BUSINESS SCENARIO .................................................................................................................................... 3
CREATE DATA DICTIONARY (DDIC) OBJECTS ........................................................................................... 3
Create Structure ZCR_BUSINESS_AREA......................................................................................................... 3
Create Database Table ZUSMD_CR_BUSAREA ................................................................................................ 3
CREATE AND IMPLEMENT CLASSES ........................................................................................................... 4
Genil Handler Class for Change Request Root: ZCL_USMD_CR_GIL_ROOT_ENHANCED ........................... 4
Genil Handler Class: ZCL_CR_GIL_REQ_BUS_AREA..................................................................................... 5
Feeder Class for Additional UIBB: ZCL_USMD_CR_GUIBB_REQ_BUS_AREA............................................... 9
CREATE ENHANCEMENT OF GENIL DATA MODEL OF CHANGE REQUEST (GENIL MODEL CR)...... 10
Create Enhancement ZMDG_CR_ADDITIONAL_FIELDS.............................................................................. 11
Create Dependent Object ZCR_REQ_BUSINESS_AREA ............................................................................... 12
Create Relation ZCR_ReqBusAreaRel ........................................................................................................ 14
CREATION OF NEW FORM UIBB FOR ADDITIONAL DATA ...................................................................... 16
Create Workbench Component Configuration ........................................................................................... 16
INTEGRATION OF NEW UIBB IN CR TABBED UIBB .................................................................................. 19
Add New UIBB................................................................................................................................................ 19
Add Wire Schema .......................................................................................................................................... 20
EXTENDED BUSINESS SCENARIO.............................................................................................................. 21
BUSINESS SCENARIO
In this example, you require an extra parameter to control the process and the workflow for change
requests - Requesting Business Area.
You do not model this parameter is as part of the MDG data model because it is not part of the business
context. Instead, you store the parameter together with the change request number in a Z-table.
In addition, you place the parameter on the change request UIBB on the tab for the general data. The user
can select from business areas defined in Customizing. (The relevant data element is GSBER and the
relevant table is TGSB). When a user opens the change request for display, the Requesting Business Area
parameter is displayed and cannot be changed.
CREATE DATA DICTIONARY (DDIC) OBJECTS
The following data dictionary objects will be needed in the configuration steps later on.
Create Structure ZCR_BUSINESS_AREA
The Genil Attribute Structure for Business Area (ZCR_BUSINESS_AREA) structure contains a component
for the additional parameter Requesting Business Area and uses the existing data element GSBER. Later,
you use this attribute structure to enhance the Genil data model of the change request.
Create Database Table ZUSMD_CR_BUSAREA
Later, you use the Assignment of Business Area to Change Request (ZUSMD_CR_BUSAREA) transparent
table to store the additional parameter Requesting Business Area.
This class is a redefinition of the Enhancement of Genil Handler CR Root (CL_USMD_CR_GIL_ROOT) class.
In our example, we add the Registration of subordinate genil handlers (REGISTER_TX_HANDLER) public
instance method.
In addition, we define attribute MT_TX_HANDLERS to keep the registered subordinate handler instances
and a corresponding table type TT_TX_HANDLER.
The source code for the ZCL_USMD_CR_GIL_ROOT_ENHANCED class is shown below.
Source code for class ZCL_USMD_CR_GIL_ROOT_ENHANCED
class ZCL_USMD_CR_GIL_ROOT_ENHANCED definition
public
inheriting from CL_USMD_CR_GIL_ROOT
final
create public .
public section.
types TT_TX_HANDLER TYPE STANDARD TABLE OF REF TO if_genil_node_handler_tx .
methods REGISTER_TX_HANDLER
importing
!IO_TX_HANDLER type ref to IF_GENIL_NODE_HANDLER_TX .
protected section.
data MT_TX_HANDLERS type TT_TX_HANDLER .
private section.
ENDCLASS.
The ZCL_CR_GIL_REQ_BUS_AREA class is a redefinition of the Genil Handler for Enhancement Req
Business Area (CL_GENIL_NODE_HANDLER_TX) class.
The handler class of the Genil Object takes care of the data operations (for example Create, Read, and
Delete) of the corresponding object.
In our example, you must redefine the following methods:
GET_KEYS_BY_PARENT
Typically used to get the keys for 1..n relations (for example, retrieving all attachments of a change
request).
CHANGE_OBJECT
Called if a dependent object is going to be created.
GET_ATTRIBUTES
Used to retrieve the attribute data of the dependent object.
GET_ATTRIBUTE_PROPERTIES
Used to set the attribute properties (e.g. read only, changeable) of the dependent object.
CONSTRUCTOR
ls_bus_area-crequest = lv_crequest_id.
ENDIF.
LOOP AT it_changed_attributes INTO ls_chg_attributes.
ASSIGN COMPONENT ls_chg_attributes OF STRUCTURE ls_attributes TO <lv_value>.
IF sy-subrc = 0 AND <lv_value> IS ASSIGNED.
ASSIGN COMPONENT ls_chg_attributes OF STRUCTURE ls_bus_area TO <lv_value2>.
IF sy-subrc = 0 AND <lv_value2> IS ASSIGNED.
<lv_value2> = <lv_value>.
lv_data_changed = abap_true.
ENDIF.
ENDIF.
ENDLOOP.
IF lv_data_changed = abap_true.
MODIFY zusmd_cr_busarea FROM ls_bus_area.
ENDIF.
ENDIF.
rv_success = abap_true.
ENDMETHOD.
* <SIGNATURE>----------------------------------------------------------------+
* | Instance Public Method ZCL_CR_GIL_REQ_BUS_AREA->CONSTRUCTOR
* +--------------------------------------------------------------------------+
* | [--->] IV_HANDLER_FACTORY
TYPE REF TOCL_GENIL_NODE_HANDLER_FACTORY
* | [--->] IV_OBJECT_NAME
TYPE
CRMT_EXT_OBJ_NAME
* | [--->] IV_PARENT_COMPONENT
TYPE REF TO IF_GENIL_APPL_INTLAY
* +---------------------------------------------------------------</SIGNATURE>
METHOD constructor.
DATA:
lo_tx_handler TYPE REF TO if_genil_node_handler_tx,
lv_root_object_name TYPE crmt_ext_obj_name,
lo_root_handler TYPE REF TO zcl_usmd_cr_gil_root_enhanced.
CALL METHOD super->constructor
EXPORTING
iv_handler_factory = iv_handler_factory
iv_object_name
= iv_object_name
iv_parent_component = iv_parent_component.
"if this instance of node handler class does implement the tx interface of
"GenIL objects (IF_GENIL_NODE_HANDLER_TX) register it to its root as a tx
"handler that needs to be called whenever tx methods are called for the
"root object itself
TRY.
lo_tx_handler ?= me.
CATCH cx_sy_move_cast_error.
RETURN.
ENDTRY.
lv_root_object_name = me->object_model->get_root_object( iv_object_name = me>my_object_name ).
lo_root_handler ?= me->handler_factory->get_base_obj_handler( lv_root_object_name ).
lo_root_handler->register_tx_handler( lo_tx_handler ).
ENDMETHOD.
*
*
*
*
*
<SIGNATURE>----------------------------------------------------------------+
| Instance Protected Method ZCL_CR_GIL_REQ_BUS_AREA->GET_ATTRIBUTES
+--------------------------------------------------------------------------+
| [--->] IV_CONT_OBJ
TYPE REF TO IF_GENIL_CONTAINER_OBJECT
| [--->] IS_KEY
TYPE
ANY
* +---------------------------------------------------------------</SIGNATURE>
METHOD get_attributes.
DATA ls_key
TYPE bss_cril_root_key.
DATA ls_bus_area_ui TYPE zcr_business_area.
DATA ls_bus_area_db TYPE zusmd_cr_busarea.
ls_key = is_key.
SELECT SINGLE * FROM zusmd_cr_busarea INTO ls_bus_area_db WHERE crequest = ls_keycr_id.
MOVE-CORRESPONDING ls_bus_area_db TO ls_bus_area_ui.
iv_cont_obj->set_attributes( is_attributes = ls_bus_area_ui ).
ENDMETHOD.
* <SIGNATURE>----------------------------------------------------------------+
* | Instance Protected Method ZCL_CR_GIL_REQ_BUS_AREA->GET_ATTRIBUTE_PROPERTIES
* +--------------------------------------------------------------------------+
* | [--->] IS_KEY
TYPE
ANY
TYPE REF TO IF_GENIL_OBJ_ATTR_PROPERTIES
* | [--->] IV_PROPERTY_OBJECT
* +---------------------------------------------------------------</SIGNATURE>
METHOD get_attribute_properties.
iv_property_object->set_property_by_name(
iv_name = 'BUS_AREA'
iv_value = if_genil_obj_attr_properties=>changeable
).
ENDMETHOD.
* <SIGNATURE>----------------------------------------------------------------+
* | Instance Protected Method ZCL_CR_GIL_REQ_BUS_AREA->GET_KEYS_BY_PARENT
* +--------------------------------------------------------------------------+
* | [--->] IV_PARENT
TYPE REF TO IF_GENIL_CONTAINER_OBJECT
* | [--->] IV_PARENT_REL
TYPE
CRMT_RELATION_NAME
* | [--->] IV_REL_FILTER
TYPE REF TO IF_GENIL_RELATION_FILTER
* | [<-->] CT_CHILD_KEYS
TYPE
STANDARD TABLE
* +---------------------------------------------------------------</SIGNATURE>
method GET_KEYS_BY_PARENT.
DATA lv_cr_id TYPE bss_cril_root_key.
CASE iv_parent_rel.
WHEN 'ZCR_ReqBusAreaRel'.
" Get CR IS
iv_parent->get_key( IMPORTING es_key = lv_cr_id ).
APPEND lv_cr_id TO ct_child_keys.
WHEN OTHERS.
ENDCASE.
endmethod.
ENDCLASS.
CREATE ENHANCEMENT OF GENIL DATA MODEL OF CHANGE REQUEST (GENIL MODEL CR)
The Change Request is represented by the Genil Component CR in the SAP system. You can have a look at
this component in the transaction GENIL_MODEL_BROWSER by entering the component CR and choosing
Display.
The Change Request itself is represented by a Root Object (CR_Root) and several Dependent Objects:
CR_Root:
Contains the elementary attributes of a change request like ID, Description, Status, CR Type.
CR_Attachment:
Represents the attachments (of type file as well as of type link) of a change request
CR_Note:
Represents the notes that an end user can attach to a change request.
CR_Targetsystem:
Represents the target systems that can be maintained for a change request.
10
The GenIL modeling approach ensures that an enhancement of the CR component with data that is
customer specific, such as the addition of a few additional attributes to the change request, results in the
creation of an additional Dependent Object in the change request component.
The following steps explain how to create as well as integrate a new Dependent Object for the CR
component using an enhancement. This enhancement will add the additional process control parameter
Requesting Business Unit to the change request.
Create Enhancement ZMDG_CR_ADDITIONAL_FIELDS
Call transaction GENIL_MODEL_BROWSER, choose the radio button Enhancement, enter a corresponding
name and choose Create. In the dialog box, enter a suitable description, as well as the CR component for
the component that needs to be enhanced. Finally, enter a suitable package for the enhancement.
After completing these steps, the CR component is displayed again, this time with a new header that
reflects the context of the newly-created enhancement.
11
In order to add the additional attribute to the CR component, select the dependent objects, and choose
Create Dependent Object from the shortcut menu. Enter ZCR_REQ_BUSINESS_AREA as name for the
new dependent object.
12
The key structure represents the key information of the additional dataset. In this example, at least the
CR ID must be part of the key in order to create the relationship to the change request itself. You can
include the CR ID in the key by including structure BSS_CRIL_ROOT_KEY into the key structure.
Additional key fields are only required if the new dependent object can have multiple occurrences.
Attribute structure: ZCR_BUSINESS_AREA
The attribute structure represents the real attributes that you add to the change request.
IMPORTANT : To be able to display the key elements of the new dependent object on the user interface,
you must add the key elements redundantly to the attribute structure.
Root Object: CR_Root
This field indicates to which root object the new dependent object belongs. Note that this field is case
sensitive.
Handler Class: ZCL_CR_GIL_REQ_BUS_AREA
The handler class takes care of all data operations on the new attributes such as Create, Read, Change,
Delete as well as additional information (for example, field properties.)
13
To establish the connection between the root object CR_Root object and the dependent object
ZCR_REQ_BUSINESS_AREA, open the sub-tree of CR_Root and create a new relation:
14
The relation defines the type of relation that is built up between the two objects as well as the
corresponding cardinality. In our example, we create an aggregation with cardinality 0..1.
Additionally, you must maintain the assigned object CR_Root. (Later, we need the name of the relation in
the UI configuration).
15
When you have implemented changes, perform a check and make sure that no errors or warnings occur.
CREATION OF NEW FORM UIBB FOR ADDITIONAL DATA
Create Workbench Component Configuration
1. Call the Web Dynpro Application FPM_FORM_UIBB_GL2 using the Object Navigator (transaction
code SE80) and start the component configuration FPM_FORM_UIBB_GL2_TEMPLATE as
shown below:
16
17
4. Enable editing of the new configuration by clicking the Continue in Change Mode button.
5. In the General Settings area, specify a Feeder Class and choose the Edit Parameters button.
7. If required, you can adjust the layout can be adjusted as shown in the screenshot.
18
In this scenario, you place the additional field Requesting Business Area in the General Data tab page of the
Change Request UIBB.
The following activities are client-dependent and must be performed in the MDG-client.
Add New UIBB
1. To access the UIBB Configuration Mode, start the Object Navigator and press Shift-F5.
2. In the Object Selection popup, select the Web-Objects tab and enter the Web Dynpro Application:
CUSTOMIZE_COMPONENT.
19
Now the CR UIBB contains the new customer specific field Requesting Business Area.
20
When the change request is saved the entered value for the Requesting Business Area together with the
Change Request ID is stored to data base table ZUSMD_CR_BUSAREA.
The additional parameter Requesting Business Area is not relevant for all users. Its visibility shall depend on
the change request type. In our example the parameter is visible if change request types T1C01 or T1C02
are used.
21
" Enter empty field for dropdown list box for "Business Area"
READ TABLE et_field_description ASSIGNING <ls_field_description> WITH KEY name =
'BUS_AREA'.
IF sy-subrc = 0 AND <ls_field_description> IS ASSIGNED.
<ls_field_description>-is_nullable = abap_true.
ENDIF.
ENDMETHOD.
method GET_ATTR_VALUE_SET.
FIELD-SYMBOLS <ls_value_set> LIKE LINE OF et_value_set.
SELECT gsber gsber FROM tgsb INTO TABLE et_value_set. "#EC CI_GENBUFF
LOOP AT et_value_set ASSIGNING <ls_value_set>.
SELECT SINGLE gtext FROM tgsbt INTO <ls_value_set>-text
WHERE spras = sy-langu
AND gsber = <ls_value_set>-value.
ENDLOOP.
endmethod.
Additional remarks:
The above shown pattern can be used to evaluate other parameters returned by the method
IF_USMD_APP_CONTEXT~GET_ATTRIBUTES (for example, EV_PROCESS).
If you use one Genil Model Extension together with different UIBBs and corresponding feeder classes,
the evaluation of parameters can be different for different feeder classes.
22
www.sap.com