Hello @MioYasutake @rileyrainey @Arley ,
Please find below my code and let me know where errors come up.
ProCat.cds
using { ZPR_HIRED_PLANT_PO_DETAILS_SRV } from './external/ZPR_HIRED_PLANT_PO_DETAILS_SRV';
service ProCat {
entity PurchaseorderList as projection on ZPR_HIRED_PLANT_PO_DETAILS_SRV.PO_HEADERSet;
}
ProCat.js
const cds = require("@sap/cds");
const { ConnectBackend } = require('./lib/ConnectionHandler');
module.exports = cds.service.impl(async function () {
const { PurchaseorderList } = this.entities;
this.on("READ", PurchaseorderList, ConnectBackend)
});
Backend connection I have made one different connection handler.
ConnectionHandler.js
const cds = require("@sap/cds");
async function ConnectBackend(req,res)
{
const backendconnect = await cds.connect.to("ZPR_HIRED_PLANT_PO_DETAILS_SRV");
const tx = backendconnect.tx(req.query);
return tx.run(req.query);
}
module.exports = {
ConnectBackend
}
Package.json
"cds": {
"requires": {
"ZPR_HIRED_PLANT_PO_DETAILS_SRV": {
"kind": "odata-v2",
"model": "srv/external/ZPR_HIRED_PLANT_PO_DETAILS_SRV",
"credentials": {
"destination": "capsap",
"path": "/sap/opu/odata/sap/ZPR_HIRED_PLANT_PO_DETAILS_SRV"
}
}
}
}
.env file to bypass the proxy for SAP BAS
I have also attached the screenshot of the BAS Error and browser error with network trace and odata call response with out cap.
Please help me to close this issue.
Regards,
Pragnesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.