- 使用SAP C4C OData notification实现CR
- SAP UI5 OData V4 模型的构造方式
- 如何在postman里为类型为Edm.DateTime的ODat
- SAP OData服务性能测量的几种工具和手段
- SAPUI5 (36) - OData Model 连接后端 S
- SAP Gateway Foundation Client Pr
- SAP Cloud for Customer的Mashup位于C
- SAP Gateway Service Builder 里的 O
- SAP CRM和C4C数据同步的两种方式概述:SAP PI和HC
- SAP C4C里嵌入SAP Analytics Cloud的案例
There is a useful feature OData notification in C4C which allows any kinds of external applications such as other SAP system or third party applications to hook the create, update and delete of a given business object in C4C.
In this blog, I will demonstrate the technical steps needed to monitor the create or update of C4C Opportunity in SAP CRM On-Premise system, that is, whenever a new Opportunity is created or updated in C4C, this change event is logged in SAP CRM accordingly. This might not be a valid case from business perspective, but you could just follow the steps to build your own integration scenario.
Detail steps
(1) Log on C4C, work center Administrator, General Settings
->OData: Event Notification to External Systems
![](https://img.haomeiwen.com/i2085791/e7b50e5afca87869.png)
Create a new Consumer by clicking button Add Row. Suppose system A6P is my CRM On-Premise and client 213 is the client where I expect to monitor the C4C Opportunity creation.
Here I specify Consumer Endpoint as https://<crm host name>/sap/bc/bsp/sap/crm?sap-client=213, which means once the ICF service in CRM under path /sap/bc/bsp/sap/crm will be called to log the C4C opportunity creation. I will create the ICF handler for this service in CRM in next step.
![](https://img.haomeiwen.com/i2085791/f6fb93a49f3eab05.png)
In Subscription tab, select corresponding Business Object and OData service for Opportunity. Since I am only interested with Create and Update, so mark the first two check-boxes accordingly.
![](https://img.haomeiwen.com/i2085791/aff56c034cd10b99.png)
(2) Go to CRM system, create a new ICF service in tcode SICF under path /sap/bc/bsp/sap/crm.
Of course you could change the path according to your own requirement.
![](https://img.haomeiwen.com/i2085791/b976ef3c23263a09.png)
Create a new handler class for this service and activate both.
![](https://img.haomeiwen.com/i2085791/248cbb8263fa189c.png)
It is ready now to write some real logic in CRM.
Paste the following source code and activate the class.
METHOD if_http_extension~handle_request.
DATA(lv_payload) = server->request->get_cdata( ).
CALL METHOD zcl_c4c_crm_integration_tool=>parse_json_to_internal_table
EXPORTING
iv_json = lv_payload
IMPORTING
et_node = DATA(lt_node).
READ TABLE lt_node ASSIGNING FIELD-SYMBOL(<event>) WITH KEY attribute = 'event'.
DATA(lv_event) = <event>-value.
READ TABLE lt_node ASSIGNING FIELD-SYMBOL(<opp>) WITH KEY attribute = 'odataServiceEndpoint'.
DATA(lv_opp_detail) = zcl_c4c_crm_integration_tool=>get_opp_detail( <opp>-value ).
CLEAR: lt_node.
CALL METHOD zcl_c4c_crm_integration_tool=>parse_json_to_internal_table
EXPORTING
iv_json = lv_opp_detail
IMPORTING
et_node = lt_node.
ENDMETHOD.
Now go to C4C system, make some changes on Opportunity name field, for example change it to “Jerry change demo”,
![](https://img.haomeiwen.com/i2085791/76f5f97e0ee1679d.png)
And then the handler method in CRM will automatically be called.
Here below is an example of payload sent from C4C system, including BO instance id and change event type.
![](https://img.haomeiwen.com/i2085791/3cdc5f4baf07f107.png)
The detail information of changed opportunity could also be retrieved as well.
![](https://img.haomeiwen.com/i2085791/66f97f319640f811.png)
Further reading
You can find a list of all other blogs related to OData written by Jerry.
- Consume standard C4C OData service via ABAP code
- Leverage C4C Odata notification to monitor C4C Opportunity change in CRM system
- OData Service backend implementation in C4C, CRM and S4 HANA
- JMeter beginner – how to use JMeter to measure performance of OData service accessed parallelly
- Regarding cookie manipulation in CL_HTTP_CLIENT to avoid CSRF token validation failure issue
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
![](https://img.haomeiwen.com/i2085791/fc7ecd97deb67090.png)
网友评论