SAP RFC Function Module as REST GET service
Hi All,
This is my first blog.
This is a step by step example of how to consume RFC function module as REST Service using GET operation.
System: SAP PI 7.4
This example will follow this workflow:
3rd Party System <-> PI RESTAdapter (JSON) <-> PI Mapping (XML) <-> PI RFC Adapter(XML) <-> SAP R3
Bussiness Case Description
A 3rd party system consumes a REST service which published in SAP PI to get the company name and the city.
Scenario – We are going to pass Company Code(BUKRS) as a parameter (GET operation) and get the Company Name and City as output.
- Import the Function Module to ESB.
- I used external definitions as data types.
- Create Service Interface. Use External Definitions for the Request and Response.
- Create Message Mapping for Request and Response.In Request Mapping Add Custom Function.
- I have added function named getBUKRS with two parameters which named namespace and attribute.
- Added following code into the function body.(This function is usnig for extract the parameter from the URL)
Map<String, Object> all = container.getInputHeader().getAll();
DynamicConfiguration dynConf = (DynamicConfiguration)all.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(namespace, attribute);
return dynConf.get(key);
-
- Map Request as following. Pass http://sap.com/xi/XI/System/REST and “id” for the constants.
- Map the response.
- Create Output Mapping.
- Go to Integration Builder and create receiver and sender communication channels.
- Receiver-
- Sender-
- Create Integrated Configuration.
- Test using SOAP UI.
Hi experts!!
I have a similar case, I am trying to consume RFC function module as REST Service but using a POST operation. I think I am not able to construct the request message in JSON, I am getting the following Error message in SOAPUI:
"InterfaceDetermination did not yield any actual interface"
Can someone help?
Thank you,
A bit late, but maybe useful to others searching. This is possible. see https://sapintegrationhub.blogspot.com/2019/08/end-end-scenario-with-rest-sender.html
Hi,
Does anyone know how to do the above where the RFC has 4 import parameters? There are many examples of where the RFC has 1 import parameter, but none where the RFC has more than 1 import parameter!
it is possible. Below is a external definition of multiple import parameters. May be I can help you, If you are more specific on your problem,