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: 

Navigation is supported in soap data source when a web service has such an operation which takes an input parameter which is the key element of another entity set.

Steps from Design Time tool

  1. Create an OData Service Implementation Project
  2. Create an OData Model for 2 entities salesOrders and Customers. Define a navigation from customers to salesOrders as below. This model fetches all the salesOrders for a specific customer. So the web service must have an operation like getSalesOrders and this operation must take customerId as an input parameter and return the sales order list. Here Navigation Property Name is SalesOrdersSet

    3. Right click on odatasvc and choose Select data source

    4. Select the SalesOrders entitySet and choose the query CRUD operation. Select the data source SOAP Service.


    5. Specify the wsdl file and choose the getSalesOrders operation from the list of soap operations and click on finish

    6. Right click on Query and select Define Custom Code

     7. Select the script type as either javascript or groovy script

     8. The navigation segment path has to be fetched from the odata request uri and a proper request payload has to be created. If the navigation segment path is like CustomerSet(10)/SalesOrdersSet, then the key predicate customerId = 10 must be fetched from the navigation segment path and this should be an input parameter to the web service operation getSalesOrders.

function processRequestData(message) {
var uriInfo = getUriInfo(message);
var map = new HashMap();
var navSegments = uriInfo.getNavigationSegments();
var first = true;
if (navSegments.size() > 0) {
  var keyPredicate = "";
  for (var i=0; i<uriInfo.getKeyPredicates().size();i++) {
   var key=uriInfo.getKeyPredicates().get(i);
   edmSimpleType = key.getProperty().getType();
   if (first) {
    first = false;
   } else {
    first = true;
   keyPredicate = getWhereString(key, edmSimpleType);
  map.put("CustID", keyPredicate);
return message;
function getUriInfo(message) {
var uriInfo = message.getHeaders().get(
return uriInfo;
function getWhereString(key, edmSimpleType) {
var appendStr = "";
if (!(edmSimpleType == EdmSimpleTypeKind.Int16
   || edmSimpleType == EdmSimpleTypeKind.Int32
   || edmSimpleType == EdmSimpleTypeKind.Int64
   || edmSimpleType == EdmSimpleTypeKind.Decimal
     .getEdmSimpleTypeInstance() || edmSimpleType == EdmSimpleTypeKind.Double
    .getEdmSimpleTypeInstance())) {
  appendStr = "\'" + key.getLiteral() + "\'";
} else {
  appendStr = key.getLiteral();
return appendStr;

If the OData request is https://localhost:8083/gateway/odata/SAP/SOAP;v=1/CustomersSet(10)/SalesOrdersSet

The request payload looks like


   9. Right click on Query and select Define Response Mapping

   10. Do the response mapping.

   11. Select a data source for the other entity set as well.

   12. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.

Now fire an OData Request https://localhost:8083/gateway/odata/SAP/SOAP;v=1/CustomersSet(10)/SalesOrdersSet on the browser and response will give the list of sales orders with customerId 10.

1 Comment