cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CDS service does not display data even though it exist.

navalega0109
Participant
0 Likes
1,957

Hello Expert,

If I deploy my application locally then in temporary port it displays data in the endpoints which do exists in the database explorer.

SS-1 :

Temporary Port:

navalega0109_0-1722955678013.png

DB Explorer Data Exist:

navalega0109_1-1722955748826.png

But once we deploy this then service created in dev space in my BTP account does not display any data in it.

navalega0109_2-1722955862142.png

Is this issue with CDS 7 ?

Note: I'm using {"auth":"mocked"} in the package.json;

Also note that even if I use xsuaa authentication then also after authentication data is not getting populated.

Can anyone help me understand what is error? or If I'm missing anything here?

With xsuaa authentication no data fetched; tested it in postman. Refer the screen shot.

navalega0109_0-1722956534312.png

My 'package.json' for reference is:

 

{
  "name": "IT_CHARM",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "engine": {
    "node": "^12 || ^14"
  },
  "private": true,
  "dependencies": {
    "@sap/cds": "^7",
    "@sap/cds-hana": "^2",
    "@sap/xssec": "^4",
    "express": "^4"
  },
  "devDependencies": {
    "@cap-js/sqlite": "^1",
    "@sap/cds-dk": "^7",
    "@sap/eslint-plugin-cds": "^3",
    "eslint": "^9"
  },
  "scripts": {
    "start": "cds-serve"
  },
  "cds": {
    "build": {
      "tasks": [
        {
          "for": "hana",
          "dest": "../db"
        },
        {
          "for": "node-cf"
        }
      ]
    },
    "requires": {
      "db": {
        "kind": "hana-cloud"
      },
      "auth":"mocked"
    }
  }
}

 

 

Regards,

Ganesh N.

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert

I suspect the deployment of your application to create a new HDI container in HANA Cloud. Verify that your deployed application is connecting to the same database as your local testing. You can see this in the BTP Cockpit under Environment Variables for your app.

navalega0109
Participant
0 Likes
@Willem_Pardaens You are right, Thanks for the help. My app is connection to DB which I deleted in DB explorer; How can I correct this? Why it is not connecting to the database HDI container which I created for my project. Can you please guide me?
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Likes

That is defined during deployment. Are you using an MTA file? In there is probably mentioned that the database is a 'managed service', so the deployment process deploys it for the application. The one you created 'manually' for testing is not relevant. The standard process would be that you let the deployer create the database, and then use hybrid testing to use the same database for your tests. But you should never manually change database tables or data outside of the development framework (eg. CAP artifacts and HANA native artifacts) because the deployer will overwrite that with your code

navalega0109
Participant
0 Likes

Hi @Willem_Pardaens ,

This is my HDB explorer DB instance

navalega0109_0-1723190148731.png

My SAP HANA PROJECTS deployed in SAP BAS

navalega0109_1-1723190186418.png

It is reflecting correct db name but pointing to wrong instance which I already deleted.

Below screen shot from ENV Var in application.

navalega0109_2-1723190353365.png

Please check and let me know how to correct this issue.

I guess issue is with yaml file is it not getting updated with correct instance for my db?

Below was my old HDI instance which I had deleted from the explorer.

navalega0109_0-1723191149534.png

Regards,

Ganesh N

 

 

 

 

 

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert

You can try and update your MTA file to point to the existing HDI container:

resources:
  - name: IT_CHARM-HDB01
    type: org.cloudfoundry.existing-service
navalega0109
Participant
0 Likes

Hi @Willem_Pardaens ,

Your solution worked. But this is strange that after bind complete yaml file is not getting updated with recent HDI container instance attached to SAP project.

 

navalega0109_0-1723199891326.png

Thanks for the help. 🙂

Answers (0)