SapHanaTutorial.Com HOME     Learning-Materials Interview-Q&A Certifications Quiz Online-Courses Forum Jobs Trendz FAQs  
     Explore The World of Hana With Us     
About Us
Contact Us
 Apps
X
HANA App
>>>
Hadoop App
>>>
Tutorial App on SAP HANA
This app is an All-In-One package to provide everything to HANA Lovers.

It contains
1. Courses on SAP HANA - Basics, Modeling and Administration
2. Multiple Quizzes on Overview, Modelling, Architeture, and Administration
3. Most popular articles on SAP HANA
4. Series of Interview questions to brushup your HANA skills
Tutorial App on Hadoop
This app is an All-In-One package to provide everything to Hadoop Lovers.

It contains
1. Courses on Hadoop - Basics and Advanced
2. Multiple Quizzes on Basics, MapReduce and HDFS
3. Most popular articles on Hadoop
4. Series of Interview questions to brushup your skills
Apps
HANA App
Hadoop App
';
Search
Stay Connected
Search Topics
Topic Index
+
-
XSA Overview
+
-
XS Overview
+
-
Hello World Example
+
-
XS OData Service
+
-
HANA XSJS Service
+
-
Core Data Service
+
-
Others

User-Defined Structured Type in CDS

In the article SAP HANA Core Data Service, we explained
  • What is HANA Core Data Service?
  • How to create a HANA table using Core Data Service?
In this article, we will show how to create User-Defined Structured Type in CDS.
In CDS, we can create structured type as reusable component. For example:
type MyStructuredType
                {
                  aNumber   : Integer;
                  someText  : String(80);
                  otherText : String(80);
                };

For each structured type defined in a CDS document, an SAP HANA table type is generated.

Example of User-Defined Structured Type in CDS:

In previous article , we created a CDS file to create a HANA table. Let us extend that to use a structured type.

  1. Create a structured type “NameType” by using below code.
type NameType
        {
                FirstName : String(20);
                LastName : String(20);
        };
  1. Create a simple type Amount by using below code.
type Amount : Decimal(15,2);
  1. In the Entity definition, use the type NameType and Amount.
Entity Employee {
                key Id : Integer;
                Name : NameType;
                Salary: Amount;
      };

User-Defined Structured Type in CDS HANA
  1. Activate the CDS file. This will generate the structured type and table.
  2. Open Catalog, go to schema “MY_SCHEMA” and check the type and table.
User-Defined Structured Type in CDS HANA

Click here to download the complete project.

Continue reading:



Support us by sharing this article.



Explore More
Close X
Close X

Leave a Reply

Your email address will not be published. Required fields are marked *

Current day month ye@r *

 © 2017 : saphanatutorial.com, All rights reserved.  Privacy Policy