Skip to Content
-1

OData SAPUI5

So, I am using this example https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.InputStates/code/V.view.xml


But I need to consume a remote OData service(http://services.odata.org/Northwind/Northwind.svc), and not a local JSON.

How can I do it?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 08, 2017 at 07:28 PM

    Since your UI5 application is running on a different server when compared to oData Model you will encounter Same-origin policy issues.

    Below solution is only for WebIDE with HCP account.

    Step 1: Create HCP destination as per Walkthrough tutorial by changing neo-app.json and manifest.json


    Step 2: in the view change the binding to refer to the model from manifest.json

    Model name in manifest.json is invoice

    Code is taken from the explored app, and changed only dialog fragment file.

    <core:FragmentDefinition
    	xmlns="sap.m"
    	xmlns:core="sap.ui.core">
    	<SelectDialog
    		title="Products Test"
    		class="sapUiPopupWithPadding"
    		items="{invoice>/Products}"
    		search="_handleValueHelpSearch"
    		confirm="_handleValueHelpClose"
    		cancel="_handleValueHelpClose">
    		<StandardListItem
    			iconDensityAware="false"
    			iconInset="false"
    			title="{invoice>ProductName}"
    			description="{invoice>QuantityPerUnit}" />
    	</SelectDialog>
    </core:FragmentDefinition>
    


    Output:


    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2017 at 08:23 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09, 2017 at 02:01 PM

    just use it in your code, you will see the difference, if i am not wrong.

    Add comment
    10|10000 characters needed characters exceeded