SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

SAP HANA XS Advanced, Creating an OData Service with Create Operation and XSJS Exit

Creating an the basic database artifacts, an OData Service with Create Operation and XSJS Exit to insert data into Entities

Overview

🎓 intermediate 15 min. SAP HANAIntermediateOdataExpress Edition

You will learn

  • Now to expand your code to include an XSJS exit
Thomas Jung T Thomas Jung November 1, 2022
Created on September 6, 2016
Contributors

More from Thomas Jung

See all 226 tutorials by Thomas Jung →

Prerequisites

Prerequisites

Steps

Step 1 Create User entity and DB artifacts

You will first create the entities that will be modified by the XSJS exit in your OData service. The exit will create a new User in the User table.

In your db\src\data folder, create a file called User.hdbtable.

Create UserData.hdbcds
Create UserData.hdbcds

Delete any existing content and paste the following entities definition:

SQL
COLUMN TABLE "UserData.User" (
     "UserId" INTEGER GENERATED ALWAYS AS IDENTITY (NO CYCLE NO CACHE NO MINVALUE START WITH 1 INCREMENT BY 1 MAXVALUE 1999999999) NOT NULL COMMENT 'User ID',
	 "FirstName" NVARCHAR(40) COMMENT 'First Name',
	 "LastName" NVARCHAR(40) COMMENT 'Last Name',
	 "Email" NVARCHAR(255) COMMENT 'Email',
	 PRIMARY KEY ("UserId"))
	 COMMENT 'User DB'
	 UNLOAD PRIORITY 5 AUTO MERGE

Save and Build the src folder.

Step 2 Create the first XSJS library
+
Step 3 Create new OData service
+
Step 4 Create the second XSJS library
+
Step 5 Save and run
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Create User entity and DB artifacts 2. Create the first XSJS library 3. Create new OData service 4. Create the second XSJS library 5. Save and run