S4D430
Data Modeling in ABAP Dictionary
and ABAP Core Data Services
.
.
PARTICIPANT HANDBOOK
INSTRUCTOR-LED TRAINING
.
Course Version: 24
Course Duration: 4 Day(s)
Material Number: 50165751
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
SAP Copyrights, Trademarks and
Disclaimers
© 2024 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the
express permission of SAP SE or an SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other
countries. Please see https://www.sap.com/corporate/en/legal/copyright.html for additional
trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software
components of other software vendors.
National product specifications may vary.
These materials may have been machine translated and may contain grammatical errors or
inaccuracies.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only,
without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate
company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business
outlined in this document or any related presentation, or to develop or release any functionality
mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’
strategy and possible future developments, products, and/or platform directions and functionality are
all subject to change and may be changed by SAP SE or its affiliated companies at any time for any
reason without notice. The information in this document is not a commitment, promise, or legal
obligation to deliver any material, code, or functionality. All forward-looking statements are subject to
various risks and uncertainties that could cause actual results to differ materially from expectations.
Readers are cautioned not to place undue reliance on these forward-looking statements, which speak
only as of their dates, and they should not be relied upon in making purchasing decisions.
© Copyright. All rights reserved. iii
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Typographic Conventions
American English is the standard used in this handbook.
The following typographic conventions are also used.
This information is displayed in the instructor’s presentation
Demonstration
Procedure
Warning or Caution
Hint
Related or Additional Information
Facilitated Discussion
User interface control Example text
Window title Example text
iv © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Contents
vii Course Overview
1 Unit 1: Exploring Data Modeling in ABAP
3 Lesson: Exploring ABAP Dictionary
9 Lesson: Exploring ABAP Core Data Services
17 Unit 2: Creating Database Tables
19 Lesson: Defining Domains and Data Elements
27 Lesson: Creating Database Tables
41 Lesson: Handling Changes to Database Tables
55 Unit 3: Defining Global Data Types
57 Lesson: Using Dictionary Objects as Data Types
61 Lesson: Defining Dictionary Structures
65 Lesson: Defining Dictionary Table Types
75 Unit 4: Defining Basic CDS Views
77 Lesson: Defining a Basic CDS View
87 Lesson: Using ABAP Annotations in CDS Views
95 Lesson: Building Views on Views
101 Unit 5: Defining Relationships and Associations
103 Lesson: Defining Relationships Between Database Tables
113 Lesson: Defining Associations Between CDS Views
119 Lesson: Using Associations in Path Expressions
129 Unit 6: Using Code Pushdown in CDS Views
131 Lesson: Implementing SQL Expressions in CDS Views
139 Lesson: Calling Built-in Functions in CDS Views
145 Lesson: Defining CDS Views with Input Parameters
155 Lesson: Processing Data Sets in CDS Views
167 Unit 7: Defining Meta Objects for Dictionary Objects and CDS Views
169 Lesson: Preventing Unauthorized Access to Data
181 Lesson: Extending Dictionary Objects
189 Lesson: Extending CDS Views
195 Lesson: Creating Metadata Extensions
© Copyright. All rights reserved. v
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
vi © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Course Overview
TARGET AUDIENCE
This course is intended for the following audiences:
● Development Consultant
● Developer
© Copyright. All rights reserved. vii
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
viii © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
UNIT 1 Exploring Data Modeling in
ABAP
Lesson 1
Exploring ABAP Dictionary 3
Lesson 2
Exploring ABAP Core Data Services 9
UNIT OBJECTIVES
● Describe the basic tasks of the ABAP Dictionary
● Name the most important Dictionary objects
● Describe the basic tasks of the ABAP Core Data Services
● Name the most important ABAP CDS objects
© Copyright. All rights reserved. 1
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Unit 1: Exploring Data Modeling in ABAP
2 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Unit 1
Lesson 1
Exploring ABAP Dictionary
LESSON OBJECTIVES
After completing this lesson, you will be able to:
● Describe the basic tasks of the ABAP Dictionary
● Name the most important Dictionary objects
ABAP Dictionary Functions
ABAP Dictionary in the Classical ABAP World
Figure 1: ABAP Dictionary in the Classical ABAP World
The ABAP Dictionary has always played a central role in ABAP programming and does to
date.
ABAP Dictionary fulfills the following tasks:
● Defining database objects (tables and views)
● Providing data types for ABAP code
● Providing additional services for classical User Interfaces
Let us have a closer look at these tasks.
© Copyright. All rights reserved. 3
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Figure 2: Database Object Definitions in the ABAP Dictionary
A database table definition in the ABAP Dictionary is a representation of the table on the
database. It is independent from the details of the database. As an example, it uses its own
built-in types and not the DB-specific types. The definition contains the field list of the table
and additional table properties.
When ABAP code accesses the database table in an ABAP SQL statement, the ABAP Syntax
check analyzes the definition in the ABAP Dictionary. Among other things, it makes sure the
table and the table fields exist.
At runtime, the database Interface translates the ABAP SQL statement into the database
specific SQL syntax and sends it to the database. For this, it also queries the table definition in
the ABAP Dictionary.
Note:
In the past, database views were handled in the same way. But those ABAP
dictionary views are outdated and ABAP Core Data Services views are used
instead (see the next lesson).
Unit 1: Exploring Data Modeling in ABAP
4 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Figure 3: Data Types in the ABAP Dictionary
The second task of the ABAP dictionary is the providing of data types for ABAP code. The
data types defined in the ABAP Dictionary are visible in the entire system. This distinguishes
them from data types defined with ABAP keyword TYPES.
Dictionary types can be scalar types (data elements), structure types (structures) and table
types. The definitions of database tables have a double role: In the first place, they define a
database object, but in addition, they can also serve as data types in ABAP code.
Note:
In general, the use of database table definitions as data types is not
recommended. Use dedicated structure types instead.
Figure 4: Services for Classical UI Development (outdated)
Lesson: Exploring ABAP Dictionary
© Copyright. All rights reserved. 5
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
In the classical ABAP UI technologies, the ABAP Dictionary fulfilled a third task. Dictionary
objects, mostly structure types and database table definitions, were enriched with semantic
information, like foreign key relations and search help bindings. When UI elements referenced
the dictionary objects, the additional information was used to provide end user texts, value
helps, input checks, and so on.
This task of the ABAP Dictionary is not relevant for modern UI technologies, namely the ABAP
RESTful Application Programming Model. The ABAP RESTful Application Programming Model
uses metadata in CDS entities to provide services for the user interface.
Note:
In this training course we will not discuss ABAP Dictionary features related to
classical ABAP UI programming. Classical ABAP UI techniques are outdated and
not supported in ABAP Cloud.
ABAP Dictionary Objects
Figure 5: Overview - Important ABAP Dictionary Objects
Let us give you an overview of the most important ABAP Dictionary objects.
● Domains neither define database objects nor are they ABAP data types. They are only
used indirectly, inside of data elements.
● Data elements, structures, and table types define ABAP data types. They do not define
database objects of their own.
● The main purpose of database table definitions and database views is the definition of a
corresponding database object. You can also use them as data types, but that is not
recommended. Dictionary views are outdated and you should use CDS views instead.
Unit 1: Exploring Data Modeling in ABAP
6 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Figure 6: ABAP Dictionary Objects in ADT
In the Project Explorer of ADT, you find the dictionary objects under the development
package, in a dedicated node Dictionary.
LESSON SUMMARY
You should now be able to:
● Describe the basic tasks of the ABAP Dictionary
● Name the most important Dictionary objects
Lesson: Exploring ABAP Dictionary
© Copyright. All rights reserved. 7
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Unit 1: Exploring Data Modeling in ABAP
8 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Unit 1
Lesson 2
Exploring ABAP Core Data Services
LESSON OBJECTIVES
After completing this lesson, you will be able to:
● Describe the basic tasks of the ABAP Core Data Services
● Name the most important ABAP CDS objects
ABAP CDS Functionality
ABAP Core Data Services (ABAP CDS)
Figure 7: ABAP Core Data Services (ABAP CDS)
The ABAP Core Data Services (ABAP CDS) are the implementation of the general core data
services concept for ABAP.
ABAP CDS fulfills the following tasks:
● Defining data models (views and functions) on the database
● Provide metadata for consumers (for example modern user interfaces) by semantically
enriching the data models
● Support the ABAP RESTful Application Programming Model
Let us have a closer look at these tasks.
© Copyright. All rights reserved. 9
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Figure 8: Defining Views in ABAP
For a long time, ABAP developers defined views in the ABAP dictionary, in the same way they
define database tables. These dictionary views were very limited in terms of SQL logic. They
only supported inner joins, a field selection (projection) and simple filter conditions. Note, that
the definition of dictionary views is not supported in cloud based ABAP environments.
One of the reasons why SAP introduced Core Data Services in ABAP was the demand for the
execution of logic on the database. As you will learn later in this training, ABAP CDS views
support a large variety of SQL expressions and functions to push down logic onto the
database.
There are two types of CDS views.
CDS DDIC-based views (obsolete)
This obsolete type of CDS views uses a generated dictionary view as technical
representation for the database object. CDS DDIC-based views are defined with the
DEFINE VIEW statement.
CDS View Entities
This new generation of CDS views is defined with the DEFINE VIEW ENTITY statement.
CDS view entities define the database object directly, without generating a dictionary
object, first.
Note:
In this training, we will only cover CDS view entities. For the older view types, refer
to the ABAP keyword documentation.
Unit 1: Exploring Data Modeling in ABAP
10 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Figure 9: Providing Metadata
ABAP CDS not only supports the technical definition of database objects. It also allows you to
enrich the technical definitions with semantic information.
Let us have a look at an example.
CDS view entity Z00_C_Employee is defined with a define view entitystatement in a
CDS data definition. This is the technical definition of the view, and it is used to create a view
named Z00_C_EMPLOYEE on the database. In addition to the define view entity
statement, the source code contains annotations. Annotations are code elements that enrich
the technical view definition with semantic information. Annotations start with an at-sign (@).
Only a few annotations are evaluated by the ABAP system. The rest is simply passed on to the
consumers of the CDS entity, that is, the frameworks that use the CDS entity to read data.
The consumers decide by their own which annotations they evaluate and which they ignore.
The most important consumers of ABAP CDS entities are modern UI technologies like SAP
Fiori and SAP S/4HANA embedded analytics.
Figure 10: CDS in the ABAP RESTful Application Programming Model
Lesson: Exploring ABAP Core Data Services
© Copyright. All rights reserved. 11
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
The heart of the ABAP RESTful Application Programming Model is the Business Object.
The structure of the Business Object is modeled with one or more CDS view entities. A CDS
behavior definition is used to add the transactional logic. The transactional logic is
implemented in an ABAP behavior pool, an ABAP class in the ABAP source code library.
Business Objects are often consumed by Business Services, for example OData services. But
you can also access them in ABAP code, using the Entity Manipulation Language (EML).
Note:
The details of modeling, implementing and using Business Objects are not part of
this training. They are discussed in a dedicated course on the ABAP RESTful
Application Programming Model.
ABAP CDS Objects
Figure 11: Overview - Important ABAP CDS Objects
Important CDS development objects are as follows:
CDS Data Definition
A CDS data definition contains the definition of one CDS entity. The most important CDS
entities are CDS view entities and their predecessors, the now obsolete DDIC-based
views.
But there are many other CDS entity types that you can define in a data definition:
● CDS projection views are based on a CDS view and project a subset of its elements.
● CDS Abstract Entities describe only type properties and for which no database
objects are instantiated.
● CDS Table Functions are implemented in database functions and return a tabular
result set.
● CDS Custom Entities are implemented manually, for example in ABAP code.
● CDS Hierarchies define SQL hierarchies from an SQL source.
Unit 1: Exploring Data Modeling in ABAP
12 © Copyright. All rights reserved.
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com

S4D430 Col24 Data Modeling in ABAP Dictionary and ABAP Core Data Services

  • 1.
    S4D430 Data Modeling inABAP Dictionary and ABAP Core Data Services . . PARTICIPANT HANDBOOK INSTRUCTOR-LED TRAINING . Course Version: 24 Course Duration: 4 Day(s) Material Number: 50165751 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 2.
    Librería ERP —Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 3.
    SAP Copyrights, Trademarksand Disclaimers © 2024 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see https://www.sap.com/corporate/en/legal/copyright.html for additional trademark information and notices. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials may have been machine translated and may contain grammatical errors or inaccuracies. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions. © Copyright. All rights reserved. iii Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 4.
    Typographic Conventions American Englishis the standard used in this handbook. The following typographic conventions are also used. This information is displayed in the instructor’s presentation Demonstration Procedure Warning or Caution Hint Related or Additional Information Facilitated Discussion User interface control Example text Window title Example text iv © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 5.
    Contents vii Course Overview 1Unit 1: Exploring Data Modeling in ABAP 3 Lesson: Exploring ABAP Dictionary 9 Lesson: Exploring ABAP Core Data Services 17 Unit 2: Creating Database Tables 19 Lesson: Defining Domains and Data Elements 27 Lesson: Creating Database Tables 41 Lesson: Handling Changes to Database Tables 55 Unit 3: Defining Global Data Types 57 Lesson: Using Dictionary Objects as Data Types 61 Lesson: Defining Dictionary Structures 65 Lesson: Defining Dictionary Table Types 75 Unit 4: Defining Basic CDS Views 77 Lesson: Defining a Basic CDS View 87 Lesson: Using ABAP Annotations in CDS Views 95 Lesson: Building Views on Views 101 Unit 5: Defining Relationships and Associations 103 Lesson: Defining Relationships Between Database Tables 113 Lesson: Defining Associations Between CDS Views 119 Lesson: Using Associations in Path Expressions 129 Unit 6: Using Code Pushdown in CDS Views 131 Lesson: Implementing SQL Expressions in CDS Views 139 Lesson: Calling Built-in Functions in CDS Views 145 Lesson: Defining CDS Views with Input Parameters 155 Lesson: Processing Data Sets in CDS Views 167 Unit 7: Defining Meta Objects for Dictionary Objects and CDS Views 169 Lesson: Preventing Unauthorized Access to Data 181 Lesson: Extending Dictionary Objects 189 Lesson: Extending CDS Views 195 Lesson: Creating Metadata Extensions © Copyright. All rights reserved. v Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 6.
    vi © Copyright.All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 7.
    Course Overview TARGET AUDIENCE Thiscourse is intended for the following audiences: ● Development Consultant ● Developer © Copyright. All rights reserved. vii Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 8.
    viii © Copyright.All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 9.
    UNIT 1 ExploringData Modeling in ABAP Lesson 1 Exploring ABAP Dictionary 3 Lesson 2 Exploring ABAP Core Data Services 9 UNIT OBJECTIVES ● Describe the basic tasks of the ABAP Dictionary ● Name the most important Dictionary objects ● Describe the basic tasks of the ABAP Core Data Services ● Name the most important ABAP CDS objects © Copyright. All rights reserved. 1 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 10.
    Unit 1: ExploringData Modeling in ABAP 2 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 11.
    Unit 1 Lesson 1 ExploringABAP Dictionary LESSON OBJECTIVES After completing this lesson, you will be able to: ● Describe the basic tasks of the ABAP Dictionary ● Name the most important Dictionary objects ABAP Dictionary Functions ABAP Dictionary in the Classical ABAP World Figure 1: ABAP Dictionary in the Classical ABAP World The ABAP Dictionary has always played a central role in ABAP programming and does to date. ABAP Dictionary fulfills the following tasks: ● Defining database objects (tables and views) ● Providing data types for ABAP code ● Providing additional services for classical User Interfaces Let us have a closer look at these tasks. © Copyright. All rights reserved. 3 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 12.
    Figure 2: DatabaseObject Definitions in the ABAP Dictionary A database table definition in the ABAP Dictionary is a representation of the table on the database. It is independent from the details of the database. As an example, it uses its own built-in types and not the DB-specific types. The definition contains the field list of the table and additional table properties. When ABAP code accesses the database table in an ABAP SQL statement, the ABAP Syntax check analyzes the definition in the ABAP Dictionary. Among other things, it makes sure the table and the table fields exist. At runtime, the database Interface translates the ABAP SQL statement into the database specific SQL syntax and sends it to the database. For this, it also queries the table definition in the ABAP Dictionary. Note: In the past, database views were handled in the same way. But those ABAP dictionary views are outdated and ABAP Core Data Services views are used instead (see the next lesson). Unit 1: Exploring Data Modeling in ABAP 4 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 13.
    Figure 3: DataTypes in the ABAP Dictionary The second task of the ABAP dictionary is the providing of data types for ABAP code. The data types defined in the ABAP Dictionary are visible in the entire system. This distinguishes them from data types defined with ABAP keyword TYPES. Dictionary types can be scalar types (data elements), structure types (structures) and table types. The definitions of database tables have a double role: In the first place, they define a database object, but in addition, they can also serve as data types in ABAP code. Note: In general, the use of database table definitions as data types is not recommended. Use dedicated structure types instead. Figure 4: Services for Classical UI Development (outdated) Lesson: Exploring ABAP Dictionary © Copyright. All rights reserved. 5 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 14.
    In the classicalABAP UI technologies, the ABAP Dictionary fulfilled a third task. Dictionary objects, mostly structure types and database table definitions, were enriched with semantic information, like foreign key relations and search help bindings. When UI elements referenced the dictionary objects, the additional information was used to provide end user texts, value helps, input checks, and so on. This task of the ABAP Dictionary is not relevant for modern UI technologies, namely the ABAP RESTful Application Programming Model. The ABAP RESTful Application Programming Model uses metadata in CDS entities to provide services for the user interface. Note: In this training course we will not discuss ABAP Dictionary features related to classical ABAP UI programming. Classical ABAP UI techniques are outdated and not supported in ABAP Cloud. ABAP Dictionary Objects Figure 5: Overview - Important ABAP Dictionary Objects Let us give you an overview of the most important ABAP Dictionary objects. ● Domains neither define database objects nor are they ABAP data types. They are only used indirectly, inside of data elements. ● Data elements, structures, and table types define ABAP data types. They do not define database objects of their own. ● The main purpose of database table definitions and database views is the definition of a corresponding database object. You can also use them as data types, but that is not recommended. Dictionary views are outdated and you should use CDS views instead. Unit 1: Exploring Data Modeling in ABAP 6 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 15.
    Figure 6: ABAPDictionary Objects in ADT In the Project Explorer of ADT, you find the dictionary objects under the development package, in a dedicated node Dictionary. LESSON SUMMARY You should now be able to: ● Describe the basic tasks of the ABAP Dictionary ● Name the most important Dictionary objects Lesson: Exploring ABAP Dictionary © Copyright. All rights reserved. 7 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 16.
    Unit 1: ExploringData Modeling in ABAP 8 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 17.
    Unit 1 Lesson 2 ExploringABAP Core Data Services LESSON OBJECTIVES After completing this lesson, you will be able to: ● Describe the basic tasks of the ABAP Core Data Services ● Name the most important ABAP CDS objects ABAP CDS Functionality ABAP Core Data Services (ABAP CDS) Figure 7: ABAP Core Data Services (ABAP CDS) The ABAP Core Data Services (ABAP CDS) are the implementation of the general core data services concept for ABAP. ABAP CDS fulfills the following tasks: ● Defining data models (views and functions) on the database ● Provide metadata for consumers (for example modern user interfaces) by semantically enriching the data models ● Support the ABAP RESTful Application Programming Model Let us have a closer look at these tasks. © Copyright. All rights reserved. 9 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 18.
    Figure 8: DefiningViews in ABAP For a long time, ABAP developers defined views in the ABAP dictionary, in the same way they define database tables. These dictionary views were very limited in terms of SQL logic. They only supported inner joins, a field selection (projection) and simple filter conditions. Note, that the definition of dictionary views is not supported in cloud based ABAP environments. One of the reasons why SAP introduced Core Data Services in ABAP was the demand for the execution of logic on the database. As you will learn later in this training, ABAP CDS views support a large variety of SQL expressions and functions to push down logic onto the database. There are two types of CDS views. CDS DDIC-based views (obsolete) This obsolete type of CDS views uses a generated dictionary view as technical representation for the database object. CDS DDIC-based views are defined with the DEFINE VIEW statement. CDS View Entities This new generation of CDS views is defined with the DEFINE VIEW ENTITY statement. CDS view entities define the database object directly, without generating a dictionary object, first. Note: In this training, we will only cover CDS view entities. For the older view types, refer to the ABAP keyword documentation. Unit 1: Exploring Data Modeling in ABAP 10 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 19.
    Figure 9: ProvidingMetadata ABAP CDS not only supports the technical definition of database objects. It also allows you to enrich the technical definitions with semantic information. Let us have a look at an example. CDS view entity Z00_C_Employee is defined with a define view entitystatement in a CDS data definition. This is the technical definition of the view, and it is used to create a view named Z00_C_EMPLOYEE on the database. In addition to the define view entity statement, the source code contains annotations. Annotations are code elements that enrich the technical view definition with semantic information. Annotations start with an at-sign (@). Only a few annotations are evaluated by the ABAP system. The rest is simply passed on to the consumers of the CDS entity, that is, the frameworks that use the CDS entity to read data. The consumers decide by their own which annotations they evaluate and which they ignore. The most important consumers of ABAP CDS entities are modern UI technologies like SAP Fiori and SAP S/4HANA embedded analytics. Figure 10: CDS in the ABAP RESTful Application Programming Model Lesson: Exploring ABAP Core Data Services © Copyright. All rights reserved. 11 Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com
  • 20.
    The heart ofthe ABAP RESTful Application Programming Model is the Business Object. The structure of the Business Object is modeled with one or more CDS view entities. A CDS behavior definition is used to add the transactional logic. The transactional logic is implemented in an ABAP behavior pool, an ABAP class in the ABAP source code library. Business Objects are often consumed by Business Services, for example OData services. But you can also access them in ABAP code, using the Entity Manipulation Language (EML). Note: The details of modeling, implementing and using Business Objects are not part of this training. They are discussed in a dedicated course on the ABAP RESTful Application Programming Model. ABAP CDS Objects Figure 11: Overview - Important ABAP CDS Objects Important CDS development objects are as follows: CDS Data Definition A CDS data definition contains the definition of one CDS entity. The most important CDS entities are CDS view entities and their predecessors, the now obsolete DDIC-based views. But there are many other CDS entity types that you can define in a data definition: ● CDS projection views are based on a CDS view and project a subset of its elements. ● CDS Abstract Entities describe only type properties and for which no database objects are instantiated. ● CDS Table Functions are implemented in database functions and return a tabular result set. ● CDS Custom Entities are implemented manually, for example in ABAP code. ● CDS Hierarchies define SQL hierarchies from an SQL source. Unit 1: Exploring Data Modeling in ABAP 12 © Copyright. All rights reserved. Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com Librería ERP — Sample | libreriaerp.com/us | info@libreriaerp.com