cancel
Showing results for 
Search instead for 
Did you mean: 

Define an implementation for a new function into a multitenancy app extension on SAP CAP

0 Kudos
395

Hi ,

I have some issue when I try to extend a multitenant application into SAP CAP when I try to implement a new function.

Is good to know that I am using @sap/cds-mtxs library.

I already have deployed a multitenant app that was activated from a subscriber subaccount.

Also I was able to build and activate an extension app that add two new fields for an entity. Code below:

extend Sales with { // 2 new fields.... 
x_priority : String enum {high; medium; low} default 'medium'; 
x_salesRegion : String(44);
}

Now I am trying to add a new function to the service and implement it

extend service CatalogService with { 
function x_func() returns String;
}

Function implementation:

const cds = require("@sap/cds");
module.exports = cds.service.impl(async function (service) { this.on("x_func",async(req)=>{ return "Hello!"; }); });

After activating the extension and test the function x_func() on the subscriber I receive the following error message

Not sure if is possible to implement a function into a extension app and how.

Guide that I followed is here: https://cap.cloud.sap/docs/guides/extensibility/customization

Accepted Solutions (0)

Answers (1)

Answers (1)

WouterLemaire
SAP Mentor
SAP Mentor
0 Kudos

I’m not sure but in this example prepend is used: https://github.com/SAP-samples/cloud-cap-samples/blob/main/bookstore/srv/mashup.js

Maybe you can have a look into this example?