0

I've been practicing SAPUI5 with the documentation but they use SAP Web IDE to consume OData services. However, because my company won't expose their server to the cloud, I can't use SAP Web IDE so I need to use eclipse. I need a tutorial step by step (for dummies) for consuming OData with SAPUI5 from eclipse. I already know how to create them but not how to use them from eclipse.

I use the OData service from Northwind but with SAP, I'll need credentials and other things.

"dataSources": {
  "invoiceRemote": {
    "uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
    "type": "OData",
    "settings": {
      "odataVersion": "2.0"
    }
  }
}
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Naoto Amari
  • 175
  • 8
  • 16
  • As suggested in https://stackoverflow.com/a/48938411/5846045, please use SAP Web IDE Personal Edition in that case. The SAPUI5 tool for Eclipse is now officially **deprecated**. – Boghyon Hoffmann May 21 '20 at 12:58

3 Answers3

0

[...] because they won't expose their server to the cloud, I can't use SAP Web IDE

An alternative to the clould based Web IDE is the Web IDE Personal Edition which you can deploy on your local machine but still runs in the browser (localhost). Create a corresponding destination file to connect to remote systems and the rest is pretty much the same as the old Orion-based Web IDE on the cloud.

Here is the destination file for the services from odata.org (e.g. Northwind)

Description=OData service from odata.org for testing, tutorials, demos, etc.
Type=HTTP
Authentication=NoAuthentication
WebIDEUsage=odata_gen
Name=odata_org
WebIDEEnabled=true
URL=http\://services.odata.org/
ProxyType=Internet
WebIDESystem=odata_org

Otherwise, if you want to stick with eclipse, take a look at the documentation topic

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
  • Hi, yes i know about sap web ide and personal edition but in my company the won't install sap cloud connector necessary to see your server from the ide, so i have to work with eclipse :C – Naoto Amari Feb 24 '18 at 18:24
  • @NaotoAmari That's the whole point of the *Personal Edition*. You keep your on-premise services and connect them solely via destination files. Your company doesn't need to install Cloud Connector. Please, follow the documentations linked in my answer. – Boghyon Hoffmann Feb 24 '18 at 22:26
  • this week i'll try and let you know , thanks man! and to deploy what's the process? – Naoto Amari Feb 24 '18 at 22:40
  • @NaotoAmari I haven't done any deployments from the Personal Edition but the process should be the same: [*Deploy* --> *Deploy to SAPUI5 ABAP Repository*](https://help.sap.com/viewer/825270ffffe74d9f988a0f0066ad59f0/latest/en-US/1170ef65b7b3490687021c3132387829.html). Check the [requirements for connecting to ABAP systems](https://help.sap.com/viewer/825270ffffe74d9f988a0f0066ad59f0/latest/en-US/5a55141b8dff41c8b87adb4222aba3b8.html) as well. If you have troubles, [this blog post](https://blogs.sap.com/2016/02/25/troubleshooting-deployment-to-abap-system-from-sap-web-ide/) might be helpful. – Boghyon Hoffmann Feb 24 '18 at 23:35
  • @NaotoAmari So, are you using Web IDE Personal Edition by now? How did it go? According to your [next question](https://stackoverflow.com/questions/49038565/error-consuming-odata#comment85207682_49053535), it seems to be working fine. – Boghyon Hoffmann Mar 05 '18 at 21:18
  • i'm using eclipse for the moment and it's going fine – Naoto Amari Mar 05 '18 at 22:00
  • @NaotoAmari I see you actually ended up [using Web IDE Personal Edition](https://stackoverflow.com/q/49657705/5846045). Would this answer be helpful (or a solution) for the question? – Boghyon Hoffmann Apr 11 '18 at 17:29
0

An exmaple using th OData of northwind: (this i made it in eclipse but the only differece with sap web ide personal edition (i haven't try this yet but it should work) you must configure the destination file for the services)

manifest.json

 //between sap.app key you put this:
            "dataSources": {
            "mainService": {
                "uri": "/northwind/V2/OData/OData.svc/",
                "type": "OData",
                "settings": {
                    "odataVersion": "2.0",
                    "localUri": "localService/metadata.xml"
                }
            }
        }

...
// this can be empty the if your using more than two just one can be empty
"": {
            "dataSource": "mainService",
            "preload": true
        }

In my view that i'm going to use the data:

<List
                id="list"
                items="{
                    path: '/Categories',
                    sorter: {
                        path: 'Name',
                        descending: false
                        },
                    groupHeaderFactory: '.createGroupHeader'
                }"
                busyIndicatorDelay="{masterView>/delay}"
                noDataText="{masterView>/noDataText}"
                mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}"
                growing="true"
                growingScrollToLoad="true"
                updateFinished="onUpdateFinished"
                selectionChange="onSelectionChange">
                <infoToolbar>
                    <Toolbar
                        active="true"
                        id="filterBar"
                        visible="{masterView>/isFilterBarVisible}"
                        press="onOpenViewSettings">
                        <Title
                            id="filterBarLabel"
                            text="{masterView>/filterBarLabel}" />
                    </Toolbar>
                </infoToolbar>
                <items>
                    <ObjectListItem
                        type="Active"
                        press="onSelectionChange"
                        title="{Name}">
                    </ObjectListItem>
                </items>
            </List>

If you're going to use and odata made for you or consume just paste the url in the propertie "uri" of yo key dataSource (something like this: "https://proxy/name:port/sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV" don't worry this url is you could see it when yo /IWFND/MAINT_SERVICE ) and when is already to deploy it just leave the uri like this /sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV

Naoto Amari
  • 175
  • 8
  • 16
-3

I'll give you some lights, but not a full tutorial.

Working in eclipse is not that different from working with WEB IDE. First you need to use JSONModel(). You can find reference here.

Create a JSONModel object and then use the method loadData. For the sURL use (in your example): "https://services.odata.org/V2/Northwind/Northwind.svc/?$format=json"

Then, you will have your oData in your front end. Now you just need to learn how to use it in your view elements. That you can learn it here.

If you want further explanations, please make small and specific questions, so it is easier to answer directed to your needs.

xyax
  • 44
  • 5