0% found this document useful (0 votes)
52 views20 pages

CDS Views For Beginners

CDS (Core Data Services) Views in SAP are virtual data models that enhance data retrieval and manipulation through a rule-based methodology, integrating with SAP frameworks for performance optimization and security. They utilize domain-specific languages for data definition, querying, and control, and support features like annotations and associations for rich data modeling. CDS views provide a reusable and efficient approach compared to traditional SQL, enabling better integration with tools like OData and Fiori.

Uploaded by

fadilikram2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views20 pages

CDS Views For Beginners

CDS (Core Data Services) Views in SAP are virtual data models that enhance data retrieval and manipulation through a rule-based methodology, integrating with SAP frameworks for performance optimization and security. They utilize domain-specific languages for data definition, querying, and control, and support features like annotations and associations for rich data modeling. CDS views provide a reusable and efficient approach compared to traditional SQL, enabling better integration with tools like OData and Fiori.

Uploaded by

fadilikram2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

CDS Views

In SAP environment
Introduction of CDS view
A CDS (Core Data Services) View in SAP is a virtual data model that enables efficient data retrieval and
manipulation at the database layer using a Rule-based methodology. It integrates seamlessly with SAP
frameworks, providing features like performance optimization, metadata annotations, and role-based
security.

A set of domain specific languages CDS used for Defining and consuming
and Services called CDS Semantical Rich Data Model
Domain specific languages
DDL → Data definition Language
(Used to define or modify database structures, like creating, altering, or deleting tables)

DQL → Data Query Language


( Focused on querying data from the database, typically using the SELECT statement )

DCL → Data Control Language


( Manages permissions and access to the database, controlling who can perform what actions )
Semantical rich data models

Annotations Expressions Associations


Annotation is used for providing used to define calculations,
Extra or Additional information conditions, and transformations It’s the Relationship
to the CDS view directly within a CDS view between source entity and
Target entity
Pre-Requestion for Create CDS view

Basic Pre-install
IDE → Eclipse
Understanding DDLC tools in
ADT
of Database Eclipse ADT
Aspect SQL Queries CDS views
Understanding
CDS view Definition A procedural query
language for relational
databases.
A high-level Structural data
model within SAP.

• Easiest way for Reusability Queries are typically static Views are reusable across
and need to be rewritten. SAP applications.
understanding CDS view ,
just compare and learn
with SQL query Annotations No native support for Built-in support for
annotations. annotations (e.g., UI,
metadata).

Extensibility Static queries are harder Supports extensions and


to extend without enhancements in SAP
rewriting. systems.
• SQL → Structural Quarry Language use to manage data in database
• Basic syntax of SQL
Comparing CDS view with SQL for Easy to
Understand
CDS View → Core Data Services
Basic syntax of CDS view
INTERMADATE CONCEPTS

Key Function Available in CDS views

NUMERIC FUNCTIONS STRING FUNCTIONS SPECIAL FUNCTIONS


Numeric functions :

• ABS (arg)
• CEIL (arg)
• DIV (arg1, arg2)
• DIVISION (arg1, arg2, dec)
• FLOOR (arg)
• MOD (arg1, arg2)
String Functions :

• CONCAT(arg1, arg2) .
• CONCAT_WITH_SPACE(arg1, arg2, spaces )
• INSTR(arg, sub)
• LEFT(arg, len)
• LENGTH(arg)
• LTRIM(arg, char)
• REPLACE(arg1, arg2, arg3)
• RIGHT(arg,len) RPAD(arg, len, src)
• RTRIM(arg, char)
• SUBSTRING(arg, pos, len)
• Special functions

• Conversion function
• Data Function & Time function
• Type conversion function
• Unit & currency conversion function
• Annotations
ADVANCED • Expressions
• Associations
CONCEPTS
Annotations in
CDS

• Annotation is used for providing


Extra or Additional information to
the CDS view
• Category of CDS view : Header
and Elementary level Annotations
• Basic Syntax : [
@<Group>.<Function> :
<‘Value’>]
• Example : @EndUserText.label:
‘Demo_table_description’
Associations in CDS

• Association is the Relationship between


source entity(E.g.. source_table) and Target
entity(E.g.. Target_table)
• This is also Known as Lazy joins or Joins on
demand
• Syntax : <table 1> association[1..*] to
<table 2>
on <table1_field1> =<table2_field1>
How CDS • Sort description of OData(Open Data Protocol ) : it’s a type of
API .

integrate with • Simple way for using OData in CDS by Using OData annotation
• Syntax : @OData.publish: true
ODATA • Create the OData service

Use /IWFND/MAINT_SERVICE (Transaction)


To Create OData Service using CDS view name
Output data (Json format)
Advantages of CDS view
CDS (Core Data Services) views revolutionize how data is modeled,
retrieved, and consumed in SAP environments.

They provide a declarative, efficient, and reusable approach compared to


traditional SQL queries.

By pushing business logic to the database layer (code pushdown), CDS


views enhance performance, simplify maintenance, and seamlessly
integrate with SAP tools like Fiori, OData, and Analytics.
when we use CDS view when we use Open SQL

When we have reusability If we are doing dynamic programming

When we need access control on If we need to use for all entries (to

Conclusion select use buffering for example)

ODATA service creation through We have to manipulate the data in


annotation are using domain-specific database( update, modify,
• CDS view and Open SQL metadata delete ) in the ABAP runtime
is not a Competitors Environment
• Instead of being
competitors, ABAP CDS CDS can be able to handle multiple
and Open SQL support data type using AMDP method
one another Some function is available only in CDS
( Quantity conversion only present in
CDS ) and can push down logic to the
database.

When we need to create data model


which can across technologies
(ODATA, RAP, CAP)
THANK YOU

Special thanks, Jagadeesh , Ganesh Murugan , AMS


team

You might also like