springsap-cloud-sdksap-cloud-foundrys4hana

SAP Cloud SDK method for output service in OData form


We are using SAP S4HANA SDK Springboot archetype to build the application in SCP Cloud Foundry.

The requirement is to fetch the OData services from the SAP S4HANA and expose them to the Fiori UI frontend in the form of OData.

From the Java web services, we are getting the responses in JSON format: Sample JSON response

Output what I need is in the below oData format.

oData Format

This is one of the services and the same should be made available to all the java rest services. Found out Apache Olingo for converting it into odata format. But wanted to know if there is any method class in SAP SDK which supports this.


Solution

  • There are several possibilities to solve that problem:

    1. You can fake it, i.e. manually translate all the results into XML yourself just enough so that UI5 accepts it.
    2. You can expose an OData service from your backend using the SAP Cloud Platform SDK for Service Development (that is already modeled as a dependency of the SAP Cloud SDK). You can find information on how to do that here and also here.
    3. Have you considered calling the OData service from your frontend directly?