Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[CAP] Invoke custom handlers when querying local entity

const cds = require('@sap/cds');

module.exports = async srv => {

     const { Objects } = srv.entities // entities from myService.cds
   
     srv.on("myAction", async req => {
        const query = SELECT.one.from(Objects).where({ id: req.data.myId })
        const srv = await cds.connect.to('myService')
        const data = await srv.run(query)
        console.log(data) 
        return data
    })

    srv.on("READ", Objects, async req => {
        console.log("Objects called")
        // Select data from db or forward query to external system
        // ...
        // return data
    })

}

[SAPUI5] local ui5 development

1. Install node.js

2. Install UI5 Tooling

npm install --global @ui5/cli

3. Install Easy UI5 Generator, create a project and run it on your localhost

npm install -g yo generator-easy-ui5
yo easy-ui5
cd <your project name> 
npm start

4. Set up a Github project and do your initial push

git add .
git commit -m "Initial commit"
git remote add origin https://github.com/user/myUI5App.git 
git push origin master

5. Install your favorite Editor, e.g. Visual Studio Code or Atom, and open your project to edit it