Skip to Content

SAP Business Application Studio add Data Source

I've created a SAP Fiori Freestyle Project on SAP Business Application Studio, but when I select "Run Configurations" it does not shows me the "Data Source" option to bind the destination to my project.

In my subaccount I have 2 destinations available for consume OData services.

What do I need to do to be able to consume these destinations?

screenshot-1.png (9.1 kB)
screenshot-2.png (80.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Nov 29, 2020 at 05:15 PM

    Which template did you use to create the UI?which target runtime did you choose? CF or ABAP?

    In case of CF, did you use central approuter or standalone approuter

    The MTA.yaml and xs-app.json should be updated automatically.

    Please verify the following:

    1. in xs-app.json you have a route to a destination

    2. In MTA.yaml in case it is CF project
    you have destination resource and approuter module requires the destination

    e.g. xs-app.json

    .....

    "routes": [ {

    "source": "^/myserviceroute/(.*)$"

    , "target": "/$1",

    "destination": "mydestinationname",

    "authenticationType": "none" }, ]

    .....

    e.g. MTA

    ...

    modules:

    - name: mysampleapprouter
    type: approuter.nodejs

    ...

    requires:

    - name: my_destination

    resources:

    - name: my_destination

    parameters:

    service-plan: lite

    service: destination

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Yuval Morad, thanks for your help.

      The values in xs-app.json and mta.yaml was added manually, not by the Template Generator because I could not find the destination through the Generator.

      Heres my answers to your questions:

      Which template did you use to create the UI?

      R: SAP Fiori Freestyle Project: "SAPUI5 Application"

      Which target runtime did you choose? CF or ABAP?

      R: CF

      In case of CF, did you use central approuter or standalone approuter

      R: Standalone approuter

      1. in xs-app.json you have a route to a destination

      R:

      {
          "authenticationMethod": "none",
          "routes": [
              {
                  "source": "(.*)(.xsodata)",
                  "destination": "fcf7b533HanaDB"
              },
              {
                  "source": "^/V2/(.*)$",
                  "destination": "northwind_api"
              }
          ]
      }<strong><br></strong>

      2. In MTA.yaml in case it is CF project, you have destination resource and approuter module requires the destination

      R:

      (...)
      modules:
      - name: fiori20201129-approuter
        type: approuter.nodejs
        path: fiori20201129-approuter
        requires:
        - name: fioribank_destination
        - name: fiori20201129_html_repo_runtime
      (...)
      resources:
      - name: fioribank_destination
        type: org.cloudfoundry.managed-service
        parameters:
          service: destination
          service-plan: lite
      (...)<br>

      OBS.: The Destination did work in the deployed application, my problem is to make it work inside the SAP Business Application Studio.

      screenshot-1.png (53.1 kB)
  • Posted on Nov 29, 2020 at 07:55 PM

    Please share the destination set up, and the manifest.json

    I assume your destination refers to the actual odata service

    check item 7 in the blog regarding destination

    https://blogs.sap.com/2020/07/08/migrating-fiori-application-from-sap-web-ide-to-sap-business-application-studio/

    in your case

    Make sure that the following properties are set in Additional Properties of the destination:

    1. HTML5.DynamicDestination = true
    2. WebIDEEnabled = true
    3. WebIDEUsage = odata_gen
    4. WebIDEAdditionalData = full_url

    also and make sure the package.json and ui5.yaml and xs-app.json include the right content as mentioned in the blog.

    Alternatively just create a UI with UI5 and compare the package.json, ui5.yaml and xs-app.json to your project

    Add a comment
    10|10000 characters needed characters exceeded

    • Destination fcf7b533HanaDB

      Destination northwind_api

      My calls are not in the manifest.json, they are in the controller, this is for test purpouses.

      callNorthwind: function() {
        new sap.ui.model.odata.v2.ODataModel("/V2/Northwind/Northwind.svc/");
      },
      callfcf7b533HanaDB: function() {
        new sap.ui.model.odata.v2.ODataModel("/odata/catalog.xsodata");
      }<br>

      The data source now is on the screen of SAP Business Application Studio (I've added the "required" destination in mta.yaml to the wrong module, when I added it to the HTML5Module, it worked).

      The problem now is that even with data sources destination active in Business Application Studio, my requests are given me 503.

      sem-titulo.png (43.8 kB)
      screenshot-1.png (29.3 kB)
  • Posted on Dec 01, 2020 at 05:27 PM

    Hi

    I can advise how to make it work using the generated templates

    It looks your destination is host only so please remove the full_url attribute

    In addition please share the xs-app.json

    Add a comment
    10|10000 characters needed characters exceeded

    • I don't know exactly what was wrong, but I was able to fix it with a new project.

      I just added the router section in the xs-app.json, added a "destination" as a "resource" in the mta.yaml file and final step was adding this destination in the "require" section of my HTML5Module in the mta.yaml (This destinations not necessarily need to exist on CF, but it need to be on the mta.yaml).

      The only thing that is different now, is my xs-app.json (that now it looks like the code below). Maybe my "source" regex was wrong, maybe the "source" and "destination" need to have the same name. I'm not sure, but now it works.

      {
          "welcomeFile": "/index.html",
          "authenticationMethod": "none",
          "logout": {
              "logoutEndpoint": "/do/logout"
          },
          "routes": [
              {
                  "authenticationType": "none",
                  "csrfProtection": false,
                  "source": "^/fcf7b533HanaDB/(.*)$",
                  "destination": "fcf7b533HanaDB",
                  "target": "$1"
              },
              {
                  "authenticationType": "none",
                  "csrfProtection": false,
                  "source": "^/northwind_api/(.*)$",
                  "destination": "northwind_api",
                  "target": "$1"
              },
              {
                  "source": "^(.*)$",
                  "target": "$1",
                  "service": "html5-apps-repo-rt",
                  "authenticationType": "xsuaa"
              }
          ]
      }

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.