Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

From SMP 3.0 SP05 release onward there is a support of OData Query operation for a service provisioned based on a REST service. In this blog post I want to show how you can develop and deploy an OData service to the SMP3 which relies on an REST service. That means that the Integration Gateway component in SMP3 will convert on the fly data coming from the REST service into OData.


Tools Used: Eclipse Kepler


1. SAP Mobile Platform Tools plugins added to Eclipse Kepler (make sure its version should be 1.3.1 check this guide for more info)

2. SAP Mobile Platform 3.0 SP06 Runtime


I got one publicly available REST service (, i am going to convert this information into OData.






1. Create a new project in Eclipse Kepler: File>New>SAP Mobile Platform OData Implementation Project

    • Make sure you select Target Runtime server as SP06

    • Give any model name and Finish


2. Create an Entity and add properties as below:

3. Right click .odatasrv > Select Data source as REST Service

    • Request URL : /sqlrest/CUSTOMER/1

4. Expand .odatasrv > Right click Query > Define Custom code

5. Replace generated code with below code. (I have attached it in a file as well)

function getUriInfo(message) {
var uriInfo = message.getHeaders().get(ODataExchangeHeaderProperty.UriInfo.toString());
return uriInfo;
function processRequestData(message) {
return message;
function processResponseData(message) {
var payload = message.getBody();
log.logErrors(LogMessage.TechnicalError, "\n +++++++++++++++++++++++++++++++++++ TRACE OUTPUT +++++++++++++++++++++++++++++++++++\n");
log.logErrors(LogMessage.TechnicalError, "\n Original Payload is:\n" + payload);
payload = payload.replace("\n", "");
payload = payload.replaceFirst("<.xml .*?>", ""); // remove the line <?xml version="1.0"?>
payload = "<CUSTOMERSet>" + payload + "</CUSTOMERSet>";
log.logErrors(LogMessage.TechnicalError, "\n Response Payload is:\n" + payload);
log.logErrors(LogMessage.TechnicalError, "\n +++++++++++++++++++++++++++++++ END OF TRACE OUTPUT ++++++++++++++++++++++++++++++++\n");
message.setHeader("Content-Type", new java.lang.String("xml"));
return message;

6. Right click project > Generate and Deploy Integration Content

Creating a destination in Gateway cockpit:

7. Open Gateway cockpit (https://smpserver:adminport/gateway/cockpit) > Navigate to "Destinations" tab

Destination URL :

8. Select newly created destination and check if you are able to ping it .(Test connection)

9. Navigate to SERVICES > select deployed OData service (ThomasREST)> Add destination

10. Open service document



For more info, check official guide.

Enabling REST Services as OData Services

Custom Scripting functions for REST services

Note: From SMP SP06, the READ operation is supported as well. Check this blog.

Thanks mustafa.saglam and bjoernw for your continuous support.