About
Core Data Service (CDS) leverages the following language:
- Data Definition Language to define the artifacts that make up the data-persistence model.
- a query language (QL),
- and an expression language (EL)
Artifact
You can save the data-persistence object definition as a CDS artifact. CDS documents are design-time source files that contain DDL code.
SAP HANA studio recognizes the .hdbdd file extension required for CDS object definitions and calls the appropriate repository plug-in to parse the content defined in the CDS document. (CDS Text Editor, View and edit DDL source code in a CDS document )
Example
namespace p1941293394trial.gerardnico.data;
// The name of the repository package in which you created the new CDS document
// The @Schema annotation defines the name of the schema to use to store the artifacts
// If the schema you specify does not exist, you cannot activate the new CDS document.
@Schema: '_SYS_BIC'
// A CDS document can only contain one top-level context
context MyModel {
// Add structured types, if required.
type BusinessKey : String(10);
type SString : String(40);
// Contexts enable to group together related artifacts.
context MasterData {
@Catalog.tableType : #COLUMN
Entity Addresses {
key AddressId: BusinessKey;
City: SString;
PostalCode: BusinessKey;
//<[...]>
};
@Catalog.tableType : #COLUMN
Entity BusinessPartner {
key PartnerId: BusinessKey;
PartnerRole: String(3);
//<[...]>
};
};
context Sales {
//<[...]>
};
context Purchases {
//<[...]>
};
};
Comment
Text that appears after a double forward slash (//) or between a forward slash and as asterisk (/*...*/) is interpreted as a comment