参考:https://blogs.sap.com/2013/03/25/how-to-integrate-new-result-list-attributes-into-the-agent-inbox/

需求:

针对Business Role " ZJP_SRV 在Inbox对应的结果清单中,增加如下字段,对应逻辑如下:

  1. 受付日:维修工单中的受付日CREATED_DATE
  2. お客様名:维修工单中的お客様名SOLDTO_NAME
  3. 郵便番号: お客様名客户主数据中的邮编.POSTL_COD1
  4. 住所:お客様名客户主数据中的地域+市区町村+地名/番地 ZADDRES
  5. 型番:维修工单中的型番ZZZMODENO
  6. 故障内容:维修工单中的故障内容描述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了,去配置页面将字段放出,就可以使用了。

CRM INBOX 查询结果增强字段的更多相关文章

  1. 创建ASP.NET Core MVC应用程序(5)-添加查询功能 & 新字段

    创建ASP.NET Core MVC应用程序(5)-添加查询功能 & 新字段 添加查询功能 本文将实现通过Name查询用户信息. 首先更新GetAll方法以启用查询: public async ...

  2. oracle查询出的字段加引号

    SELECT 'list.add("' || t.dummy || '");' as listFROM dual t where rownum < 600; 执行结果: SE ...

  3. left join 等连接查询遇到同名字段覆盖问题

    可以在查询时给字段赋别名,但是需要注意以下:*的位置要在最前面,放在其他地方都会出错.这种写法同名覆盖的字段还在,然后在*的后面加上别名字段,已经可以满足所有需求了 SELECT *,r.id as ...

  4. [Elasticsearch] 多字段搜索 (三) - multi_match查询和多数字段 <译>

    multi_match查询 multi_match查询提供了一个简便的方法用来对多个字段执行相同的查询. NOTE 存在几种类型的multi_match查询,其中的3种正好和在“了解你的数据”一节中提 ...

  5. PDO 查询mysql返回字段整型变为String型解决方法

    PDO 查询mysql返回字段整型变为String型解决方法 使用PDO查询mysql数据库时,执行prepare,execute后,返回的字段数据全都变为字符型. 例如id在数据库中是Int的,查询 ...

  6. ElasticSearch 学习记录之ES查询添加排序字段和使用missing或existing字段查询

    ES添加排序 在默认的情况下,ES 是根据文档的得分score来进行文档额排序的.但是自己可以根据自己的针对一些字段进行排序.就像下面的查询脚本一样.下面的这个查询是根据productid这个值进行排 ...

  7. Oracle生成查询包含指定字段名对应的所有数据表记录语句

    应用场合:已知字段名字,查询数据库中所有数据表中包含该字段名的所有数据表 操作办法:指定字段名,数据库表用户,执行下面查询语句即可 --Oracle生成查询包含指定字段名对应的所有数据表记录语句 de ...

  8. mysql 去除重复 Select中DISTINCT关键字的用法 在使用mysql时,有时需要查询出某个字段不重复的记录,虽然mysql提供 有distinct这个关键字来过滤掉多余的重复记录只保留一条,但往往只用它来返回不重复记录的条数,而不是用它来返回不重记录的所有值。其原因是 distinct只能返回它的目标字段,而无法返回其它字段,这个问题让我困扰了很久,用distinct不能解决的话,

      在使用mysql时,有时需要查询出某个字段不重复的记录,虽然mysql提供 有distinct这个关键字来过滤掉多余的重复记录只保留一条,但往往只用它来返回不重复记录的条数,而不是用它来返回不重记 ...

  9. Hibernate高效查询,只查询部分/指定字段

    公司使用 DetachedCriteria detachedCriteria = DetachedCriteria.forClass(PeBulletin.class); detachedCriter ...

随机推荐

  1. [js]js设计模式-修改原型

    参考 操作原型 - 给原型添加属性 - 方法1: Fn.prototype.sum=function{} - 方法2: Fn.prototype={} //constructor指向了Object的原 ...

  2. 设置mac笔记本为固定ip

    第一步.点击Mac桌面“系统偏好设置”图标 第二步.在打开的系统偏好设置界面,点击互联网和无线选项中的“网络” 第三步.在网络界面,点击“高级”,进入高级设置.  第四步.在以太网设置界面,在TCP/ ...

  3. mongoose findByIdAndUpdate不执行的解决方法

    请参考Mongoose的文档 1.findOneAndUpdate([query], [doc], [options], [callback]) 有callback传递才执行. 2.exec是prom ...

  4. ueditor富文本上传图片的时候报错"未找上传数据"

    最近因为需求所以在ssh项目中使用了Ueditor富文本插件,但是在上传图片的时候总是提示“未找到上传数据”,之后百度了好久终于弄明白了.因为Ueditor在上传图片的时候会访问controller. ...

  5. db2常见错误代码及原因

    sqlcode sqlstate 说明000 00000 SQL语句成功完成01xxx SQL语句成功完成,但是有警告+012 01545 未限定的列名被解释为一个有相互关系的引用+098 01568 ...

  6. DRF之视图类(mixin)源码解析

     同样的增删改查操作,如果我们还像之前序列化组件那样做,代码重复率过多,所以我们用视图表示: 具体源码实现:首先定义一个视图类,然后根据mixin点进去有五个封装好的方法,这五个方法共有的属性就是都需 ...

  7. vue-cli 2.92版本 server

    一.引包 const axios = require('axios'); const express = require('express'); const apiRoutes = express.R ...

  8. idea下maven下载插件慢问题

    在pom.xml中添加maven 依赖包时,我就发现不管是否用了FQ,下载速度都好慢,就1M的东西能下半天,很是苦恼,于是到网上搜资料,然后让我查到了.说是使用阿里的maven镜像就可以了.我于是亲自 ...

  9. GoldenGate 12.3 MA架构介绍系列(5) - 静默安装

    软件下载地址 http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html 下载基于MicroService ...

  10. pytesseract使用的坑

    今天学了下python的OCR识别,其中遇到好多坑,下面就一一阐述是如何破解的,本人用的是Windows 64位,IDE是VS2017. pip版本过低. 首先安装pytesseract这个库,pip ...