cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP Dynamic Service Definition

italo_naia
Participant
0 Kudos

I have to create a dynamic service, the fields definitions come from a table, so I have to read the table and create service fields and annotations, to create a form in the UI5 (with Fiori Elements if possible).

Is there any way to do this in SAP CAP (nodejs)?

Accepted Solutions (0)

Answers (1)

Answers (1)

martinstenzig
Contributor
0 Kudos

I don't know if I understand you correctly, but I would answer with YES, you can at runtime create a new service dynamically. Here is the code...

cds.serve('SFOData').from(csn).to('odata').at(expressPath).in(cds.app).with(srv => {
        /**
         * Event handler code
         */
       ...
    })
gregorw
Active Contributor
0 Kudos

A working example how a dynamic service can be added can be found in the links of the question: CAP Node.JS: Replace implementation of existing service