Technical Articles
Develop Business Services with Node.js in SAP Web IDE
Two of the key benefits and principles of the SAP Cloud Application Programming Model are openness and flexibility. They allow developers to choose their preferred technology stack and tools.
Following these principles, SAP Web IDE introduced the option to develop business services based on the application programming model and using Node.js.
This allows developers who prefer Node.js to use it while enjoying the benefits of SAP Web IDE: a cloud-based, zero-installation development environment offering advanced tools to increase development productivity.
How to start with Node.js in SAP Web IDE?
- Create a new project.
-
- Create a new project using the “SAP Cloud Platform Business Application”
- Make sure to choose Node.js for your service.
- The generated project contains db and srv folders, and CDS files for your data-model and service definitions.
- Create a new project using the “SAP Cloud Platform Business Application”
-
-
Define a data model
- Define your data-model in the “data-model.cds” file in the “db”
- Build your database module.
- Use the database explorer to view your tables and perform actions on them.
- Define a service and implement business logic.
- Define a service in the “cat-service.cds” file in the “srv”
- To add custom logic to your service, create a new file called “cat-service.js” in the “srv” folder and implement the required logic in Node.js . (Give yourJS file the same name as that used in the service definition’s CDS )
- Run/Test your service.
Run your service by selecting the “srv” folder and choosing the Run option (from the main toolbar or from the context menu).When you access the service in runtime, the following is displayed:
Congratulations! You’ve created your first Node.js business service in SAP Web IDE 🙂
Keep in mind that Node.js business services developed with the application programming model support OData V4. If you cannot use OData V4, use OData V2 and Java instead of Node.js. (By the way, in the future, Java will also support OData V4.)
To learn more and stay updated with SAP Cloud Application Programming Model and SAP Web IDE, checkout the following channels:
- Blogs: Application Programing Model, SAP Web IDE
- Tutorials: SAP Web IDE, Application Programming Model
- Twitter: SAP Web IDE
Happy Coding!
Thanks Liat for this great blog. I was looking for this for a long time and one of your colleagues pointed me to this blog in SAP TechEd, Is there any further tutorial or help document available, if I want to develop S/4HANA extension in Node.js using WEB IDE. developer.sap.com refers only local development environment. Thanks!
Hi Gairik,
Sorry for the delayed response.
Unfortunately there's no one tutorial to guide you through the required steps.
Is there specific information you're missing?
Thanks,
Liat