Preface – This post is part of the SAP CAPM series.
Table of Contents
Introduction
In previous article we have explored the ways to define services in SAP CAP. In this article we will learn about the operations on Services in SAP CAP.
Operations on Services in SAP CAP
- Ignoring fields from Services: We can ignore fields using annotation @cds.api.ignore
- Adding Action and Functions: We can directly call a function/action, like we have used cancelLeave above, by mentioning it in node.js while calling the service. This can be done in two ways:
- Unbound action: For this type of actions, we mention the action in the service itself
srv.on('cancelLeave', (req) => { // do something ... })
- Bound action: For this type of actions, we mention the action at entity level. It means, we will have to mention the name of the entity during the call
srv.on('getEmployeeCount', 'Employees', (req) => { // do something ... })
0 Comments