Requirement

This requirement is raised by customer. They have extended a new field “Opportunity id” in My Appointment creation page. During appointment creation, customer choose an opportunity from this extension field via value help, and they would like to automatically generate a document history which links the created appointment with this manually chosen opportunity.

Implementation

create one BAdI implementation on spot CRM_APPT_ODATA_ENH with following source code:

  METHOD if_ex_crm_appt_odata~update_appointment_details.INCLUDE: crm_object_names_con,crm_object_types_con,crm_object_kinds_con,crm_mode_con.DATA: ls_doc_flow     TYPE crmt_doc_flow_com,lt_doc_flow     LIKE ct_doc_flow,ls_doc_link     TYPE crmt_doc_flow_extd,ls_appointment  LIKE LINE OF ct_appointment,lt_exception    TYPE crmt_exception_t,lt_input_fields TYPE crmt_input_field_tab,ls_input        LIKE LINE OF ct_input_fields,ls_field        LIKE LINE OF ls_input-field_names.IF sy-uname = 'WANGJER'.READ TABLE ct_appointment INTO ls_appointment INDEX 1.ASSERT sy-subrc = 0.ls_doc_flow-ref_handle = ls_appointment-ref_handle.ls_doc_flow-ref_kind   = 'A'.ls_doc_link-objkey_a   = '0050569F4AEA1ED4BFF22CF79358C400'.ls_doc_link-handle_b   = ls_appointment-ref_handle.ls_doc_link-brel_kind  = 'A'.ls_doc_link-brel_mode  = 'A'.ls_doc_link-reltype    = 'VONA'.APPEND ls_doc_link TO ls_doc_flow-doc_link.INSERT ls_doc_flow INTO TABLE lt_doc_flow.CLEAR: ls_input-field_names.ls_field = 'OBJKEY_A'.INSERT ls_field INTO TABLE ls_input-field_names.ls_field-fieldname = 'OBJTYPE_A'.INSERT ls_field INTO TABLE ls_input-field_names.ls_field-fieldname = 'OBJKEY_B'.INSERT ls_field INTO TABLE ls_input-field_names.ls_field-fieldname = 'OBJTYPE_B'.INSERT ls_field INTO TABLE ls_input-field_names.ls_field-fieldname = 'BREL_KIND'.INSERT ls_field INTO TABLE ls_input-field_names.ls_field-fieldname = 'RELTYPE'.INSERT ls_field INTO TABLE ls_input-field_names.ls_input-ref_handle = ls_appointment-ref_handle.ls_input-ref_kind    = 'A'.ls_input-objectname  = gc_object_name-doc_flow.INSERT ls_input INTO TABLE lt_input_fields.CALL FUNCTION 'CRM_ORDER_MAINTAIN'IMPORTINGet_exception      = lt_exceptionCHANGINGct_input_fields   = lt_input_fieldsct_doc_flow       = lt_doc_flowct_orderadm_h     = ct_orderadm_hEXCEPTIONSerror_occurred    = 1document_locked   = 2no_change_allowed = 3no_authority      = 4.ENDIF.ENDMETHOD.

Archievement


Appointment 成功创建之后,代码里hard code的opportunity guid对应的opportunity就会出现在Appointment的Transaction History area里:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

Use BAdI to link appointment to a given opportunity during creation相关推荐

  1. 修改某个appointment已经存在的opportunity relation

    Created by Jerry Wang, last modified on Aug 18, 2015 执行report之前: 执行report之后: *&----------------- ...

  2. 如何使用SAP零售系统中的LISTING?【中英文对照版】

    SAP Retail Listing – How does it work? 如何使用SAP零售系统中的LISTING? A. Prerequisites – SAP standard VS SAP ...

  3. Java集合框架中隐藏的设计套路

    我们的世界不应该只有"胡萝卜" 进入正题之前容我先扯点别的. 最近突然想到了一个驴子和胡萝卜不得不说的故事.说是一个人坐在驴子背上,用一根长杆绑着一根胡萝卜,然后把胡萝卜悬到驴子的 ...

  4. Java SortedMap接口总结 有序Map要实现的接口规范

    SortedMap接口源码重点 SortedMap接口继承自Map接口,自然具有Map接口定义的其他方法,Map源码可以看我这篇文章 Map 实现SortedMap接口表明该Map的键是根据排序规则有 ...

  5. 错误监控——sentry源码

    sentry-javascript为语言包,在该语言包下包含各项平台包 其中: 诸如react.vue.next等框架包为平台包,主要是引用browser功能并增添平台相关特性 browser包为浏览 ...

  6. How to get information of all attachments belonging to a given appointment

    This requirement is raised from customer, they would like to get information of all attachments belo ...

  7. 详解BLE 空中包格式—兼BLE Link layer协议解析

    BLE有几种空中包格式?常见的PDU命令有哪些?PDU和MTU的区别是什么?DLE又是什么?BLE怎么实现重传的?BLE ACK机制原理是什么?希望这篇文章能帮你回答以上问题. 虽然BLE空中包(pa ...

  8. docker如何移除所有的mysql_docker容器删除了,link怎么还在?

    楼上的回答已经讲的很清楚了,db服务没有定义,在compose中link并不是链接容器,而是服务,并且compose启动的时候会单独create network ,也并不是和db-mysql在同一个网 ...

  9. java link 使用_使用 C 实现Java LinkList

    基于 ADT 链表数据结构实现的C语言版 LinkList. C代码 typedefstruct_link_list{ inttheSize; intmodCount; struct_node *no ...

最新文章

  1. CentOS 7下使用Gitolite搭建Git私服
  2. 解决莫名其妙出现connection closed的错误
  3. Python Selenium 常用方法总结
  4. mysql ——读写分离
  5. proteus虚拟终端窗口不显示_Linux终端美化工具(ohmyzsh)
  6. 【AI与多媒体处理】
  7. java三点确定圆弧_圆弧方向判断方法和三点确定一个圆的计算方法
  8. The security settings could not be applied to the database because the connection has failed安装Mysql
  9. 012.对netmap API的解读
  10. 从3年前接触区块链,到开发出装机量最大客户端Geth,看看人家的职业发展之路 | 人物志...
  11. linux下nand flash驱动工作原理,1.3.4. Nand flash驱动工作原理
  12. JavaScript中清空数组最有效的三种方法
  13. android mac 调试,Mac下使用Android studio真机调试
  14. 第十届“认证杯”数学中国数学建模国际赛(2021年小美赛)
  15. 计算机2.0培训心得,2020信息技术2.0培训心得
  16. 华为数字化IT应用工程师面试经历
  17. WIN7系统做NTP服务器,大师教您win7系统搭建ntp服务器的图文技巧
  18. 遇见未来 | 对话叶毓睿:人类文明运行在软件之上(上篇)
  19. 亲朋好友都能看懂的区块链
  20. kill 和 kill -9 的区别

热门文章

  1. vue插件:vue-resource的使用笔记
  2. TypeScript和JavaScript哪种语言更先进
  3. Android内部自带的SQLite数据库操作dos命令
  4. 8.8-8.10 usaco
  5. iOS XMPP Framework 中文概述
  6. MinGW编译wxWidget
  7. 最全的常用正则表达式大全分享(转)
  8. ServeJson undefined (type *MainController has no field or method ServeJson
  9. 搭建(增加) jenkins slave 机器
  10. 第三次学JAVA再学不好就吃翔(part5)--基础语法之数据类型转换