参考:https://blogs.sap.com/2013/03/25/how-to-integrate-new-result-list-attributes-into-the-agent-inbox/
需求:
针对Business Role " ZJP_SRV 在Inbox对应的结果清单中,增加如下字段,对应逻辑如下:
- 受付日:维修工单中的受付日CREATED_DATE
- お客様名:维修工单中的お客様名SOLDTO_NAME
- 郵便*: お客様名客户主数据中的邮编.POSTL_COD1
- 住所:お客様名客户主数据中的地域+市区町村+地名/番地 ZADDRES
- 型番:维修工单中的型番ZZZMODENO
- 故障内容:维修工单中的故障内容描述ZGZNR
实现:
给查询结果结构增加字段:通过append struture 加入到结构CRMST_INBOX_RESULTLIST中
SE24创建处理类:ZY_CL_CRM_AUI_ONEORDER
继承父类:CL_CRM_AUI_ONEORDER
实现对应6个字段的取值:
METHOD GET_CREATE_DATE. DATA:LV_VALUE TYPE STRING,
CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,
LV_DATE TYPE CRMT_POSTING_DATE.
FIELD-SYMBOLS:<VALUES> TYPE ANY.
CLEAR: VALUE.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
VALUE = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' )->GET_PROPERTY('POSTING_DATE').
ENDIF. ENDMETHOD.
METHOD GET_ZZZMODENO. DATA:LV_VALUE TYPE STRING,
CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,
LV_DATE TYPE CRMT_POSTING_DATE.
FIELD-SYMBOLS:<VALUES> TYPE ANY.
CLEAR: VALUE.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
VALUE = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' )->GET_PROPERTY('ZZZMODENO').
ENDIF. ENDMETHOD.
METHOD GET_ZSOLD_NAME.
DATA:LR_ORDER_H TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTSET TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTALL TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART01 TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LS_PART TYPE CRMST_PARTNERADDRESS_BTIL.
DATA:LV_NAME TYPE STRING.
FIELD-SYMBOLS:<VALUE> TYPE ANY.
CLEAR: VALUE,LV_NAME.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
LR_ORDER_H = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' ).
CHECK LR_ORDER_H IS BOUND.
LR_PARTSET = LR_ORDER_H->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTHeaderPartnerSet' ).
CHECK LR_PARTSET IS BOUND.
LR_PART01 = LR_PARTSET->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartner_00000001' ).
CHECK LR_PART01 IS BOUND.
LR_PART = LR_PART01->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartnerAddress' ).
CHECK LR_PART IS BOUND.
LR_PART->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES( IMPORTING ES_ATTRIBUTES = LS_PART ). CONCATENATE LS_PART-TITLE_P LS_PART-FULLNAME INTO LV_NAME SEPARATED BY SPACE.
ASSIGN VALUE->* TO <VALUE>.
<VALUE> = LV_NAME.
ENDIF. ENDMETHOD.
METHOD GET_POSTL_COD1.
DATA:LR_ORDER_H TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTSET TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTALL TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART01 TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LS_PART TYPE CRMST_PARTNERADDRESS_BTIL.
FIELD-SYMBOLS:<VALUE> TYPE ANY.
CLEAR: VALUE.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
LR_ORDER_H = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' ).
CHECK LR_ORDER_H IS BOUND.
LR_PARTSET = LR_ORDER_H->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTHeaderPartnerSet' ).
CHECK LR_PARTSET IS BOUND.
LR_PART01 = LR_PARTSET->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartner_00000001' ).
CHECK LR_PART01 IS BOUND.
LR_PART = LR_PART01->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartnerAddress' ).
CHECK LR_PART IS BOUND.
LR_PART->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES( IMPORTING ES_ATTRIBUTES = LS_PART ). * CONCATENATE LS_PART-TITLE_P LS_PART-FULLNAME INTO LV_NAME SEPARATED BY SPACE.
ASSIGN VALUE->* TO <VALUE>.
<VALUE> = LS_PART-POSTL_COD1.
ENDIF. ENDMETHOD.
METHOD GET_ZADDRES.
DATA:LR_ORDER_H TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTSET TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PARTALL TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART01 TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_PART TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LS_PART TYPE CRMST_PARTNERADDRESS_BTIL.
DATA:LV_ADDR TYPE STRING.
DATA:GW_T005U TYPE T005U.
FIELD-SYMBOLS:<VALUE> TYPE ANY.
CLEAR: VALUE,LV_ADDR,GW_T005U.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
LR_ORDER_H = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' ).
CHECK LR_ORDER_H IS BOUND.
LR_PARTSET = LR_ORDER_H->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTHeaderPartnerSet' ).
CHECK LR_PARTSET IS BOUND.
LR_PART01 = LR_PARTSET->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartner_00000001' ).
CHECK LR_PART01 IS BOUND.
LR_PART = LR_PART01->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTPartnerAddress' ).
CHECK LR_PART IS BOUND.
LR_PART->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES( IMPORTING ES_ATTRIBUTES = LS_PART ).
SELECT SINGLE * INTO GW_T005U FROM T005U WHERE SPRAS = SY-LANGU
AND LAND1 = LS_PART-COUNTRY AND BLAND = LS_PART-REGION.
CONCATENATE GW_T005U-BEZEI LS_PART-CITY LS_PART-STREET INTO LV_ADDR SEPARATED BY SPACE.
ASSIGN VALUE->* TO <VALUE>.
<VALUE> = LV_ADDR.
ENDIF. ENDMETHOD.
METHOD GET_ZGZNR.
DATA:LR_ORDER_H TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_TEXTSET TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_TEXTALL TYPE REF TO IF_BOL_ENTITY_COL.
DATA:LR_TEXT01 TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_TEXT TYPE REF TO CL_CRM_BOL_ENTITY.
DATA:LR_ITER TYPE REF TO IF_BOL_BO_COL_ITERATOR.
DATA:LV_TEXT TYPE STRING.
FIELD-SYMBOLS:<VALUE> TYPE ANY.
CLEAR: VALUE.
CREATE DATA VALUE TYPE STRING.
IF BOL_ENTITY IS BOUND.
LR_ORDER_H = BOL_ENTITY->GET_RELATED_ENTITY( 'BTOrderHeader' ).
CHECK LR_ORDER_H IS BOUND.
LR_TEXTSET = LR_ORDER_H->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTHeaderTextSet' ).
CHECK LR_TEXTSET IS BOUND.
LR_TEXTALL = LR_TEXTSET->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BTTextHAll' ).
CHECK LR_TEXTALL IS BOUND.
LR_ITER = LR_TEXTALL->IF_BOL_BO_COL~GET_ITERATOR( ).
CHECK LR_ITER IS BOUND.
LR_TEXT ?= LR_ITER->FIND_BY_PROPERTY( EXPORTING IV_ATTR_NAME = 'TDID' IV_VALUE = 'ZH14' ).
CHECK LR_TEXT IS BOUND.
VALUE = LR_TEXT->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY( 'CONC_LINES' ).
ENDIF. ENDMETHOD.
所以方法参数都是:
ATTRIBUTE_PATH Importing Type NAME_KOMP
VALUE Returning Type Ref To DATA
然后需要让INBOX查询调用这个实现类:SPRO->Customer Relationship Management->Interaction Center WebClient->Agent Inbox
->Basic Settings for Item Types->Assign Implementation Classes:将上面创建的实现类分配给ONEORDER
下面需要去SE24创建树的叶子实现类:ZL_ICCMP_IN_INBOXITEMS_CN02
继承父类:CL_ICCMP_IN_INBOXITEMS_CN02(这个是标准的)
新建6个字段的GET 方法:
METHOD GET_POSTING_DATE.
DATA: LR_CURRENT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,
LR_DATA TYPE REF TO DATA. TRY.
LR_CURRENT = ME->BO.
LR_DATA = LR_CURRENT->GET_PROPERTY( 'CREATE_DATE' ). "#EC NOTEXT
CATCH CX_ROOT.
ENDTRY. CHECK LR_DATA IS BOUND. TRY.
VALUE = IF_BSP_MODEL_UTIL~CONVERT_TO_STRING( DATA_REF = LR_DATA
ATTRIBUTE_PATH = ATTRIBUTE_PATH ).
CATCH CX_BSP_CONV_ILLEGAL_REF.
FIELD-SYMBOLS: <L_DATA> TYPE DATA.
ASSIGN LR_DATA->* TO <L_DATA>. CONCATENATE <L_DATA> '-CURR/QUANT CONV FAILED-' INTO VALUE
SEPARATED BY SPACE. "#EC NOTEXT
CATCH CX_ROOT.
ENDTRY.
ENDMETHOD.
所以方法除字段外,其他都一致即可(数量和金额字段另处理)
下面就需要去组件中增加对应字段并放出:BSP_WD_CMPWB - 用户界面组件工作台
ICCMP_INBOX -> ICCMP_INBOX/InboxItems 因为我们只使用tree的,所以只处理这个视图
重定义GET_TABLE_LINE_SAMPLE方法,这个方法是构建树的结构字段的
METHOD get_table_line_sample.
TYPES: BEGIN OF line,
node_name TYPE string,
guid TYPE crmt_genil_object_guid,
objectid TYPE crmt_aui_object_id,
itemtype TYPE crmt_aui_maincat,
description TYPE crmt_aui_description,
priority TYPE crmt_aui_priority,
status TYPE crmt_aui_status,
dueon TYPE crmt_due_date,
createdon TYPE crmt_created_at_date,
receivedon TYPE crmt_aui_received_on,
overdue TYPE crmt_due_date,
groupassigned TYPE crmt_aui_group_assigned,
employeeassigned TYPE crmt_aui_wi_empl_assigned,
customer TYPE crmt_bsp_account,
cust_name TYPE crmt_aui_customer,
contactperson TYPE crmt_contact,
cp_name TYPE crmt_aui_contact_person,
datereceived TYPE crmt_created_at_date,
timereceived TYPE crmt_aui_changed_at,
lastupdate TYPE crm_aui_lastupdate_at,
companycode TYPE crm_ic_bd_ccode,
logicalsystem TYPE crm_ic_bd_logsys,
* back_end_client_descr TYPE crmt_ic_mapped_logsys_descr, " logicalsystem_descr
other_employeeassigned TYPE string,
other_groupassigned TYPE string,
main_cat TYPE crmt_process_type_db,
work_priority TYPE crmt_srqm_wp,
main_cat_concat TYPE crmt_aui_main_cat_concat,
sender TYPE crmt_aui_sender,
receiver TYPE crmt_aui_receiver,
created_by TYPE crmt_aui_create_by_id,
created_by_descr TYPE crmt_aui_create_by_desc,
employee_id TYPE crmt_aui_employee_id,
employee_concat TYPE crmt_aui_employee_concat,
group_id TYPE crmt_aui_group_id,
group_concat TYPE crmt_aui_group_concat,
customer_concat TYPE crmt_aui_customer_concat,
contactperson_concat TYPE crmt_aui_cp_concat,
changed_on_at TYPE crmt_aui_changed_on_at,
changed_on TYPE crmt_aui_changed_on,
changed_at TYPE crmt_aui_changed_at,
due_date TYPE crmt_aui_due_date,
due_time TYPE crmt_aui_due_time,
overdue_icon TYPE string,
status_id TYPE crmt_aui_status_id,
status_concat TYPE crmt_aui_status_concat,
priority_id TYPE crmt_aui_priority,
priority_concat TYPE crmt_aui_priority_concat,
logicalsystem_descr TYPE crmt_aui_logsys_desc,
logicalsystem_concat TYPE crmt_aui_logsys_concat,
companycode_desc TYPE crmt_aui_compcode_desc,
companycode_concat TYPE crmt_aui_compcodeconcat,
categorization_ids TYPE crmt_aui_categorization_ids,
categorization_desc TYPE crmt_aui_categorization_desc,
checklist_id TYPE crmt_aui_checklist_id,
checklist_desc TYPE crmt_aui_checklist_desc,
checklist_concat TYPE crmt_aui_checklist_concat,
doc_received_on_at TYPE crmt_aui_doc_received_on_at,
doc_received_on TYPE crmt_aui_doc_received_on,
doc_received_at TYPE crmt_aui_doc_received_at,
due_on TYPE crmt_due_date,
soc_post_type_des TYPE string,
soc_chnl_des TYPE string,
soc_senti_des TYPE string,
posting_date TYPE crmt_posting_date,
zzzmodeno TYPE zmodeno,
zsold_name TYPE string,
postl_cod1 TYPE ad_pstcd1,
zaddres TYPE string,
zgznr TYPE string,
END OF line.
CREATE DATA rv_sample TYPE line. ENDMETHOD.
重定义REFRESH方法:这个方法是指定树的实现方法的
METHOD refresh .
DATA: lv_entity TYPE REF TO cl_crm_bol_entity,
lv_iterator TYPE REF TO if_bol_bo_col_iterator,
lv_root TYPE REF TO if_bsp_wd_tree_node. * super->refresh( ).
reset_node_mapper( ). TRY.
lv_iterator = me->collection_wrapper->get_iterator( ).
lv_entity ?= lv_iterator->get_first( ).
WHILE lv_entity IS BOUND. lv_root = me->node_factory->get_proxy(
iv_bo = lv_entity
iv_proxy_type = 'ZL_ICCMP_IN_INBOXITEMS_CN02' ). lv_root->node_key = add_root_node( lv_root ).
lv_entity ?= lv_iterator->get_next( ).
** Changes ITSM CSS Next Gen
DATA: lr_cn02 TYPE REF TO cl_iccmp_in_inboxitems_cn02.
DATA: lr_owner TYPE REF TO cl_iccmp_in_inboxitems_impl.
DATA: lr_context TYPE REF TO cl_iccmp_in_inboxitems_ctxt. lr_context ?= context.
CHECK lr_context IS BOUND.
lr_owner ?= lr_context->get_owner( ). lr_cn02 ?= lv_root.
lr_cn02->set_inbox_switched( lr_owner->compcoinbox->gv_co_inbox_switched ).
lr_cn02->set_profile_type( lr_owner->compcoinbox->gv_profile_type ).
** End changes ITSM CSS Next Gen
ENDWHILE.
CATCH cx_sy_move_cast_error cx_sy_ref_is_initial.
ENDTRY.
ENDMETHOD.
这时候tree的下级节点的实现类就变成了上面的'ZL_ICCMP_IN_INBOXITEMS_CN02'
到这里基本就已经OK了,去配置页面将字段放出,就可以使用了。