cancel
Showing results for 
Search instead for 
Did you mean: 

Destination usage in SAP BAS.

01-28-2025 2:52 PM
1641 views 2 comments
SAP Managed Tags
Labels
SAP BASSAP BTP destination
Subscribe

Hello!
I am trying to make a connection to a destination via SAP BAS app, that's a SAP FSM extension. Currently I can't trigger my destinations URL.
My destination:

ervins_gleizds_0-1738070872578.png

This is my xs-app.json:

 

 

{
  "welcomeFile": "/index.html",
  "authenticationMethod": "route",
  "routes": [
    {
      "source": "^/equipmentUpdate/?(.*)",
      "target": "/$1",
      "destination": "EquipmentUpdate",
      "authenticationType": "none"
    },
    {
        "source": "^/resources/(.*)$",
        "target": "/resources/$1",
        "authenticationType": "none",
        "destination": "ui5"
    },
    {
        "source": "^/test-resources/(.*)$",
        "target": "/test-resources/$1",
        "authenticationType": "none",
        "destination": "ui5"
    },
    {
        "source": "^(.*)$",
        "target": "$1",
        "service": "html5-apps-repo-rt",
        "authenticationType": "none"
    }
  ]
}

 

 

My mta.yaml:

 

 

_schema-version: "3.2"
ID: equipment1
version: 0.0.1
modules:
- name: equipment1-destination-content
  type: com.sap.application.content
  requires:
  - name: equipment1-destination-service
    parameters:
      content-target: true
  - name: equipment1-repo-host
    parameters:
      service-key:
        name: equipment1-repo-host-key
  - name: equipment1-uaa
    parameters:
      service-key:
        name: equipment1-uaa-key
  parameters:
    content:
      instance:
        destinations:
        - Name: equipment1_html_repo_host
          ServiceInstanceName: equipment1-html5-service
          ServiceKeyName: equipment1-repo-host-key
          sap.cloud.service: equipment1
        existing_destinations_policy: update
  build-parameters:
    no-source: true
- name: equipment1-app-content
  type: com.sap.application.content
  path: .
  requires:
  - name: equipment1-repo-host
    parameters:
      content-target: true
  build-parameters:
    build-result: resources
    requires:
    - artifacts:
      - equipment1.zip
      name: equipment1
      target-path: resources/
- name: equipment1
  type: html5
  path: .
  build-parameters:
    build-result: dist
    builder: custom
    commands:
    - npm install
    - npm run build:cf
    supported-platforms: []
resources:
- name: equipment1-destination-service
  type: org.cloudfoundry.managed-service
  parameters:
    config:
      HTML5Runtime_enabled: true
      version: 1.0.0
    service: destination
    service-name: equipment1-destination-service
    service-plan: lite
- name: equipment1-uaa
  type: org.cloudfoundry.managed-service
  parameters:
    path: ./xs-security.json
    service: xsuaa
    service-name: equipment1-xsuaa-service
    service-plan: application
- name: equipment1-repo-host
  type: org.cloudfoundry.managed-service
  parameters:
    service: html5-apps-repo
    service-name: equipment1-html5-service
    service-plan: app-host
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true

 

 

My controllers function for destination call:

 

 

const response = await jQuery.ajax({
                    method: "GET",
                    url: "equipmentUpdate/http/equipment/DEV", 
                    headers: {
                        'Accept': '*/*'
                    }
                });

 

 

I get this response in browser console:

ervins_gleizds_1-1738071199314.png

ervins_gleizds_0-1738072016126.png

Maybe there is something that is missing or is incorrect?

I tried a bunch of things from blogs and videos but don't know what to do next. It looks like it's getting close to my integration flow but still far enough. 

Thanks! 

Regards,

Ervins

 

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
SAP Mentor
SAP Mentor

I would suggest you use the SAP Cloud SDK HTTP Client:

https://sap.github.io/cloud-sdk/docs/js/features/connectivity/http-client

as it will support the resolution of destinations out of the box. In BAS you can set the destination in a destinations environment variable and use http://<dest-name>.dest in the URL