CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
JerryWang
Advisor
Advisor

Document flow API in CRM


以一个具体的例子来说明。在Appointment的Overview page上能看见一个名叫Reference的区域,这里可以维护一些其他的业务文档的ID,这样可以将该业务文档同当前正在编辑的Appointment关联起来。


我写了一个简单的报表来演示如何用ABAP代码给这个Reference区域的字段赋值,背后用到的实际上就是CRM Document flow相关的API. 报表的源代码在我的github上。


代码的核心就是使用CRM One Order的function module CRM_ORDER_MAINTAIN, 把document flow相关的数据传入到changing参数ct_doc_flow里。


这个ct_doc_flow的内容生成逻辑如下。既然是Document Flow,必然涉及到两个document,在API里用后缀为A和B的字段来存储,如下图绿色区域所示。这些字段需要分别存储两个document的GUID和BOR类型。


假设我执行report时指定的Opportunity的ID是888,那么report成功执行后,我能在References区域看到如下的字段。Opportunity的ID和描述信息已经能够正常显示了。


同时在Transaction History区域也能看到该关联关系:



Document flow API in C4C


假设我需要在Cloud Application Studio里开发一个功能,允许客户能够手动将两个Ticket关联起来。


1. 在Ticket的BO ServiceRequest上创建一个新的action linkTicket用于实现关联逻辑。同时创建一个新字段用于存储需要关联的Ticket ID:



通过Cloud Application Studio将这个新字段配到UI上,同时在工具栏里新增一个按钮,绑定到BO的action linkTicket上。




Action的实现代码:



import ABSL;

var eleBTD: elementsof ServiceRequest.BusinessTransactionDocumentReference;

eleBTD.BusinessTransactionDocumentReference.ID.content = this.refTicket;
eleBTD.BusinessTransactionDocumentReference.TypeCode = "118"; // type code of BO ServiceRequest

eleBTD.BusinessTransactionDocumentRelationshipRoleCode = "2"; // Successor document
this.BusinessTransactionDocumentReference.Create(eleBTD);​



2. 假设我想把Ticket 3638和Ticket 3622关联起来,我需要打开Ticket 3638,在新字段Reference Ticket里手动输入3622,然后点击按钮Link Ticket.


成功执行之后,在Ticket的Document Flow tab即可看到这个关联关系。



更多Jerry的SAP原创技术文章,请关注我的微信公众号"汪子熙"。