In this blog, I will demonstrate how to create a new Opportunity by consuming C4C standard OData service via ABAP code.
The related OData service for Opportunity with detailed explanation on its entity types could be found from SAP help:
I will use a HTTP POST request to finish the creation. A example about how to organize post body could be found from C4C OData development guideline, where ServiceRequest is used for demonstration. I just make minor changes to make it also works on Opportunity.
First I test it in postman to ensure the successful creation:
I paste my http request body text here for your reference:
And a new opportunity could successfully be created in postman:
Now all I need to do is just to translate the activities I have done in postman into ABAP code.
I wrote an ABAP report to create Opportunity by consuming OData service:
Execute the report, new opportunity could be created and found in system:
Source code for ZCL_ODATA_TOOL:
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