In the current SAP landscape strategy C4C and SAP CRM on premise system plays critical role in data exchange. In this blog, I would like to highlight main steps involved when SAP C4C OData Service has to be consumed in SAP CRM on-Premise system.
Login to Cloud Application Studio and create any custom Business Object (BO).
Here is one example: –
Create OData Service for the custom BO using Administrator –> OData Service Explorer –> Custom OData Services by logging into SAP C4C Application
Test the service in various formats like JSON, XML. Header details can be read.
Webservice endpoint is generated. Here SAP C4C system is the provider of the web service.
Use Filter option to convert XML or to JSON format.
Eg:- $format=json and append to the URL.
This web service endpoint URL will be used in SAP CRM on premise to consume the C4C OData service.
Using Google Chrome, the Cloud server certificates can be exported to a local machine.
This certificate should be uploaded to SAP CRM on premise system to consume the web service.
To upload the certificate in SAP CRM on premise system following steps to be followed
Go to STRUST in SAP CRM
Import the Certificates in the following folders and save the changes.
– Server SSL Standard
– Anonymous SSL Client
– Standard SSL Client
If required restart ICM
Now in SAP CRM the Webservice can be consumed using SAP standard API class CL_HTTP_CLIENT
Overview on programming details: –
- First create HTTP Client using cl_http_client=>create_by_url and get the runtime object (eg:- lo_client)
- Use this object to set the request methods like GET/POST
- Set the header using following method lo_client->request->set_header_fields
- Call send method to send the request to the web service using lo_client->send
- Check the response using lo_client->receive
- Get the binary response using lo_client->response->get_data
- Convert the binary format to using cl_abap_conv_in_ce=>create to create conversion.
- Use read method to read the response.
- Use JSON parser class to convert JSON format to ABAP internal table using class CL_GIS_JSON_PARSER
- You can use the web service data as per business needs