Besides Web service C4C also provide OData service. Some OData service may be delivered by SAP, and customer can also publish their own OData service by key user. Now I will introduce an example to show how to achieve it. In this example I will read registered product data in WeChat on Mobile phone, and maintain reading data here.
Because in this example the 3rd party system is WeChat, so I assume that your WeChat official account and service agent were already prepared.
In the following blog you can find how to build up your WeChat official account server.
https://blogs.sap.com/2018/02/28/integration-of-wechat-and-c4c-service-ticket-on-html5-client/
Let's step by step to introduce it.
Login C4C system, go to Administrator->OData Service Explorer. Firstly check SAP OData service if there is one match your requirement, Otherwise, you need to create a custom OData service. For this scenario we need to create it.
The "Work Center View" means if you select it, you will get same access context from service calling user.
Three entity type involved.
- RegisteredProductCollection from root node of InstallationPoint.
- MeasurementPointCollection from root node of MeasurementPoint,
- MeasurementDocumentCollection from root node of MeasurementDocument.
Once OData service is done, next I will create views for displaying data and maintain data.
- Create views and controllers.
Create views for your application with open UI5. For example, in search screen you should have a barcode scan button, when click on which will trigger WeChat scanning function.<Button icon="sap-icon://bar-code" press="onScan" />
When Click Go on search screen, service agent will handle requesting data to C4C, the results contains registered product header data and measurement logs.
In the content view, we can show product header data and measurement logs in a list. We need to do the following things to get data on initial load.
When click on list item, measurement readings will be fetched and displayed in next view.
There we put a "New" button to handle creating new readings.
When everything done, assign the search screen view to a new menu in WeChat official account, then test it. The following screenshot shows data is successfully displayed in WeChat.
We know that there are more than 1 billion WeChat users in China. WeChat is not only a communication tool but also a platform for daily working with customer developed APPs. With SAP open UI5 and C4C OData service customer can easily build up their own application to interact with C4C.