参考: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. JDBC连接MySQL与Oracle

    JDBC连接MySQL .JDBC连接Oracle (跳转) JDBC连接MySQL import org.junit.Test; import java.sql.*; /** * JDBC连接MyS ...

  2. sql server自定义排序

    方法一: 比如需要对SQL表中的字段NAME进行如下的排序:张三(Z)李四(L)王五(W)赵六(Z) 按照sql中的默认排序规则,根据字母顺序(a~z)排,结果为:李四  王五 赵六 张三 自定义排序 ...

  3. Redis入门到高可用(二十)——Redis Cluster

    一.呼唤集群 二.数据分布概论      三.哈希分布 1.节点取余 2.一致性哈希 添加一个node5节点时,只影响n1和n2之间的数据   3.虚拟槽分区 四.基本架构 五.redis clust ...

  4. word2vec:将bin转换为txt

    转自:https://blog.csdn.net/u011684265/article/details/78024064 from gensim.models import word2vec mode ...

  5. 邮件发送 utils

    package cn.itcast.bos.utils;   import java.util.Properties;   import javax.mail.Message; import java ...

  6. Python之猴子补丁

    1.在运行时,对属性,方法,函数等进行动态替换 2.其目的往往是为了通过替换,修改来增强,扩展原有代码的能力 #test2.py class Person: def get_score(self): ...

  7. eclipse添加mybatis插件

    1,在 eclipse中选择 Help->eclipse marketplace 2, 搜索安装

  8. vue-cli 2.92版本 server

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

  9. highChart 缺值-曲线断开问题

    time =item.datetime; aqi = Number(item.aqi); pm2_5 = Number(item.pm25); pm10 = Number(item.pm10); co ...

  10. Redis初探-Redis安装

    官网地址:https://redis.io/download 最新版本是4.0,在这里本人下的是3.2 使用rz命令可以将Redis上传到Linux系统 首先要确定Linux上是否安装了gcc,没有则 ...