Professional Documents
Culture Documents
PUBLIC
Warning
This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 1/42
11/21/2019
Target Audience
ABAP developers who are involved in the code push-down development activities.
Validity of Documentation
This documentation belongs to ABAP Development Tools for SAP NetWeaver and refers to the range of functions that have been
shipped as part of the standard delivery for SAP NetWeaver 7.5, SP03.
Tip
You can also visit our ABAP for SAP HANA space on SCN to view discussions and nd further resources on how ABAP-
based applications can leverage SAP HANA.
Overview
ABAP CDS provides a framework for de ning and consuming semantic data models on the central database of the application
server AS ABAP. The speci ed data models are based on the data de nition language (DDL) and the data control language (DCL).
So, a CDS entity or the enhancement of a CDS view is de ned as source code in the CDS data de nition.
Remember
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 2/42
11/21/2019
In the DDL editor, you can only de ne one ABAP CDS entity in one DDL source.
Related Information
ABAP CDS in ABAP Dictionary
A CDS view is de ned for existing database tables and views, or for other CDS views in ABAP Dictionary, using the ABAP CDS
statement DEFINE VIEW. A CDS view serves to de ne the structure of an SQL view and represents a projection onto one or
several Dictionary tables or Dictionary views.
Note
SQL views and CDS entities are part of one and the same namespace. Therefore, you must assign different names for an SQL
view and the entity.
Example
@AbapCatalog.sqlViewName: 'CUSTOMER_VW'
DEFINE VIEW cust_book_view_entity AS SELECT FROM scustom
JOIN sbook
ON scustom.id = sbook.customid
{
scustom.id,
scustom.name,
sbook.bookid
}
The CDS entity cust_book_view_entity de nes a projection onto the database tables scustom and sbook by joining
both tables. The generated SQL view (CUSTOMER_VW) comprises the ID, the name, and the booking ID of all customers for
which the bookings exist.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 3/42
11/21/2019
An SQL view
Example
ENDMETHOD.
...
ENDCLASS.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 4/42
11/21/2019
Note
When activating a DDL source, a CDS entity and SQL view form a unity within the DDL source as development object. So, after
transporting a DDL source, the name of the CDS entity and SQL view can no more be changed. To rename any part of this unity,
you need to delete the corresponding DDL source. Consequently, you recreate it and use the new name for the relevant part.
Developer-Relevant Activities
1. Creating DDL Sources
7. [Optional:] Analyzing the SQL dependency tree of the view in case of more complex CDS views
9. [Optional:] Analyzing the relationship between views in a graphical tool in case of more complex views
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 5/42
11/21/2019
Caution
Before deleting a DDL Source, check whether it is still being used by other development objects. To nd out if an object
is still in use, call the where-used function( Searching Usages (Where-Used)). See also: Deleting Development Objects
Related Information
ABAP CDS - View
The actual CDS entity of the table function that is generated in the ABAP Dictionary
Note
In contrast to the CDS views, the CDS table functions can be implemented using Native SQL. This implementation is done
within an AMDP method of an AMDP class and is managed as an AMDP function by the AMDP framework in the database
system.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 6/42
11/21/2019
Note
The name of the implementing AMDP method can only be speci ed in a single CDS table function (1: 1 relation).
Example
Table Function De nition
In the following listing, a client-speci c ABAP CDS table function TAB_FUNCTION_EXAMPLE is de ned using the DDL syntax.
This table function declares two input parameters clnt (with the prede ned value: #CLIENT) and carrid, and a list of
elements that provide the return values of the AMDP method that implements the table function. The table function is
associated with the AMDP class CL_EXAMPLE_AMDP, where the method GET_FLIGHTS is used to implement the table
function.
Sample Code
@ClientDependent: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
define table function TAB_FUNCTION_EXAMPLE
Example
Table Function Implementation
The public ABAP class (AMDP class) in this example provides the AMDP method get_flights, which serves as the
implementation of the table function tab_function_example. As with any other AMDP class,
cl_example_amdp must implement the marker interface IF_AMDP_MARKER_HDB. The AMDP method get_flights
implements the data selection using Native SQL code.
Sample Code
public section.
interfaces IF_AMDP_MARKER_HDB.
class-methods get_flights for table function tab_function_example.
protected section.
private section.
endclass.
endclass.
Developer-Relevant Activities
1. Creating DDL Sources
Related Information
ABAP CDS Synatx – Table Functions
The CDS authorization concept coexists with the classical authorization concept of SAP NetWeaver Application Server for ABAP
(SAP NetWeaver AS for ABAP). You can use the concepts together or independently from another. The classical authorization
concept is based on authorization objects. The authorization of a user occurs either implicitly, for example while calling a
transaction, or explicitly with the statement AUTHORITY-CHECK. The CDS authorization concept is based on implicit
authorization checks that occur during access attempts to CDS entities over service adaptation de nition language (SADL) or
Open SQL.
A developer de nes a CDS role in a separate CDS source code for a CDS entity using the DCL statement DEFINE ROLE. When a
CDS entity is accessed using SADL or Open SQL, the following is checked:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 8/42
11/21/2019
If no role is de ned for a CDS entity, there are no restrictions on the data returned by the query.
If a role is de ned the CDS entity, access control management checks the current user for authorizations and reads only
that data for which an authorization exists. CDS roles are assigned to all users implicitly.
When you activate a DCL source, SAP NetWeaver AS for ABAP generates the authorization views and lls the access control
management tables with the required metadata. The roles are characterized as global internal objects in the ABAP Dictionary.
Notes
We recommend that you continue to use the classical authorization concept for start authorizations (used to check whether a
user can start an application in the rst place). The CDS authorization concept can be used within an application to perform
instance-based authorization checks (used to check the authorization of a user as de ned by the data model and the data in
question).
Related Information
Adding Access Control to CDS Entities
ABAP CDS - Access Control
Context
A DDL source allows you to de ne an entity that represent as a projection onto one or multiple database tables. With the DDL
source you have the appropriate ABAP development object, which you can use directly to access the standard ABAP Workbench
functionality (transport, syntax check, activation).
Procedure
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e20… 9/42
11/21/2019
1. In your ABAP project, select the relevant package node in the Project Explorer.
2. Open the context menu and choose New Other ABAP Repository Object Core Data Services DDL Source to launch the
creation wizard.
3. In addition to the Project and Package, enter the Name and the Description for the DDL Source to be created.
Note
The maximum length for names of DDL sources is 30 characters.
4. Choose Next.
6. Choose Finish.
Results
In the selected package, the ABAP back-end system creates an inactive version of a DDL source and stores it in the ABAP
Repository. In the Project Explorer, the new DDL source is added to the Core Data Services folder of the corresponding package
node. As a result of this creation procedure, the source editor will be opened. Here, you can start de ning a CDS entity.
Related Information
ABAP CDS Entities
ABAP Development Objects
Editing DDL Source Code
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 10/42
11/21/2019
Context
To generate a CDS view, you must activate the DDL source.
Procedure
To activate the DDL source from the DDL source editor ...
2. Click the icon (Activate the ABAP Development Object) in the toolbar.
Tip
Alternatively, you can use the keyboard shortcut Ctrl + F3 .
1. Select the node of the relevant DDL source in the ABAP project in the Project Explorer.
Results
In the selected package, the ABAP back-end system creates an active version of the CDS view and stores it in the ABAP Dictionary.
The corresponding CDS database view is added to the Core Data Services folder of the selected package.
Related Information
Displaying Activation Log for DDL Sources
Status of a Development Object
Previewing Data Records
To view the activation log for an error item in the Problems view, select the corresponding function in the context menu.
To view the activation log from the DDL source editor, choose the toolbar menu Navigate Open Navigation Log .
Note
For details, see also: Troubleshooting for Dictionary Activation Errors
Sub Topics
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 11/42
11/21/2019
Getting Help for DDL Sources
In addition, you may need to display the de nition and documentation of elements used, like tables, views, or individual table
elds that you used when de ning CDS views in the DDL editor. For this purpose, press F2 to access the code element info popup.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 12/42
11/21/2019
Tip
In addition, you will nd the complete CDS Language Reference on the SAP Help Portal.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 13/42
11/21/2019
Tip
From within the element info popup, you have the option to open the ABAP Element Info view by pressing the Show in ABAP
Element Info View icon.
Tip
When opening the element info popup for a table, you have the option to show a tree-based display that indicates the includes
or append structures – if they are de ned for the table elds.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 14/42
11/21/2019
Keyword completion: The best matching DDL keyword is automatically proposed as soon as you start typing
Semantic keyword completion: A list of all matching DDL keywords is displayed for the position where you have chosen
the Ctrl + Space shortcut
Semantic completion (data source and signature parameter completion): This enables you to insert the best matching
data sources (tables) or add the parameters of a table to the DDL source code.
Keyword Completion
In the DDL source code editor, the best matching DDL keyword is displayed when start typing the keyword. If you choose the
tabulator key, the keyword is inserted.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 15/42
11/21/2019
In the DDL source editor, you can open the code completion list manually at any position by choosing Ctrl + Space . This
enables you to add the possible keywords to your source code using the Shift + Enter shortcut.
Choose Ctrl + Space to display the list of suggested entries at this position
Semantic Completion
To get a list of best matching data sources (database tables, database views, CDS views, or CDS table functions), type the rst
letter(s) of the data source and then press Ctrl + Space .
The list with the elements of the signature is automatically displayed after you have typed a dot as the component selector. This
enables you to add a component of a table to the DDL source code.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 16/42
11/21/2019
To use a template...
1. In the DDL source editor, write the beginning characters of the template.
Tip
Alternatively, you can use the Templates view to insert the template code in the DDL source using Drag & Drop.
2. Open the New Template dialog and specify the Name and the Description, and edit the Pattern of the template.
Tip
If you want to add the new template to the DDL source creation wizard, select DDL (creation) as the Context.
Navigating Associations
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 17/42
11/21/2019
In addition to the F3 Eclipse navigation functionality, you can also navigate between the origin, the de nition, and the target of
the Associations you are using in your DDL source.
1. In the CDS source code editor, select the name of the Association.
2. Open the context menu on the name and chose Navigate To.
Note
Alternatively, you can press F3 or Ctrl + click . A small dialog is then opened below the Association name. Here you
choose Navigate To.
The cursor opens the corresponding DDL source and highlights the relevant origin or navigates to the relevant de nition within the
same DDL source. In both cases, the selected occurrences and names are highlighted.
1. In the CDS source code editor, select the name of the Association.
2. Open the context menu on the name and chose Navigate To Target.
Note
Alternatively, you can press Ctrl + click . A small dialog is then opened below the Association name. Here you choose
Navigate To Target.
Related Information
Opening Development Objects
In the DDL source code editor, the following quick xes are provided:
Effect: Adds the annotation @AbapCatalog.sqlViewName: 'SQL_VIEW_NAME' , which speci es the name of the
SQL view to be generated in the ABAP Dictionary.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 18/42
11/21/2019
Effect: Adds the annotation @AbapCatalog.sqlViewAppendName: 'APPEND_VIEW_NAME' , which speci es the
name of the append view that will be generated in the ABAP Dictionary.
Effect: Adds the GROUP BY clause that is required if aggregate functions (MAX, SUM, ...) are contained in the SELECT list.
In addition, all elements not de ned using aggregate functions are speci ed after GROUP BY.
Effect: If the GROUP BY clause is already added, you can extend this group to include all elements not de ned using
aggregate functions and not yet part of the GROUP BY clause. The latter elements, when included, are also added to the
existing GROUP BY clause.
Alias is missing
Effect: Adds an alternative name (alias) for each aggregate function that is used as an element in the SELECT list.
b. Choose Quick x .
c. In the list of possible quick xes, double-click the relevant quick x function.
b. In the list of possible quick xes, double-click the relevant quick x function.
a. In the DDL source code editor, position the cursor where the error occurs and is highlighted.
Prerequisites
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 19/42
11/21/2019
This function affects the CDS view in the currently opened editor.
Context
You can use the ON conditions wizard when de ning:
The wizard considers the used data sources and their elements and provides proposals (strategies) for joining the data sources.
As developer you can also specify the elements for a JOIN manually using drag and drop (User De ned strategy).
Procedure
1. Open the relevant CDS view in the DDL editor.
2. In the CDS source code, position the cursor on the ON keyword where you want to de ne an ON condition for a join or
association.
4. On the quick x view, double-click the De ne ON conditions entry to start the wizard.
Note
If the ON condition already exists, the mapping between elements of data sources will be displayed on the wizard page,
where you can then modify them.
5. To specify the condition expression, de ne the mapping between the source and the target data source.
The wizard offers you automatic proposals for mapping elements of the data sources:
Strategy > By Name: Elements with identical names are mapped to each other.
Strategy > By Foreign Key: Based on the foreign key relationship, that has been de ned for a table in the ABAP
Dictionary, mappings are suggested for each key de nition.
When using the User De ned option, you can map the elements in a straightforward manner using drag & drop.
In addition, the wizard provides you with additional functionality, so that you can:
Name
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 20/42
11/21/2019
Dictionary type
Built-in type
$parameter
$projection
data source
Tip
To open the context menu on the wizard page, select the relevant element from the Source or Target area.
For defining mapping drag and drop relevant elements from source to target
6. Choose Finish.
Results
The wizard inserts the corresponding condition expression after the ON keyword into the DDL source code.
Note
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 21/42
11/21/2019
The wizard does not check the syntax or semantic correctness of a CDS view. So, the modi ed coding might contain syntax or
semantic errors.
Related Information
ABAP CDS – SELECT, Association
ABAP CDS – SELECT, JOIN
You can also use the following shortcuts for comments in the DDL editor:
Ctrl + < Add Comment The editor inserts a double slash (//) at the
beginning of each selected line.
Ctrl + > Remove Comment The editor removes an existing double slash
(//) at the beginning of each selected line.
Note
Alternatively, you can access the comments functions using the context menu entries of the DDL source editor ( Source Add
Comment... )
Procedure
1. Open the General Appearance Colors and Fonts preference page.
3. Select the text type you want to change and click the Edit... button.
Remember
To restore the default color settings, click the Restore Defaults button.
Results
The new color settings become immediately effective in the source code editor.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 22/42
11/21/2019
For each CDS view entity that has been extended, a marker is added to the vertical ruler of the DDL source editor.
If you choose the marker, an extension popup will be opened. From this popup, you can navigate to the de nitions of the view
extensions that exist in the system.
Extension popup
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 23/42
11/21/2019
Automatic syntax check: This option is enabled by default for all source code based editors.
Note
If you wish to disable the automatic syntax check, you have to switch off the corresponding setting in the preferences:
ABAP Development Editors Source Code Editors Automatic syntax check .
Explicit syntax check: You can use this option whenever the automatic syntax check is disabled.
Procedure
1. Open the editor with the relevant DDL source.
2. Click the icon (Check ABAP Development Object) in the toolbar. Alternatively, you can use the keyboard shortcut
Ctrl + F2 .
Results
If errors occur during the check, these will be issued to the Problems view and displayed there as ABAP Syntax Check Problem. In
addition, the code line with the error is labeled with a decorator in the DDL source editor.
Tip
The DDL editor offers corrections to some problems found. In case of missing annotation, for example, you can take advantage
from the quick x for that speci c error item.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 24/42
11/21/2019
Accessing quick fix in the Problems view using the context menu of the error item
Related Information
Activating DDL Sources
Previewing Data Records
Related Information
CDS Graphical Editor
Displaying the Graphical Representation of DDL Source Code
Updating the Graphical Representation of a CDS Entity
Opening a CDS Entity in the Source-Based Editor
Highlighting Used Columns
Navigating Through Data Models
Positioning Objects Automatically in the CDS Source Editor
Printing and Exporting Diagrams
Context
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 25/42
11/21/2019
This visualization allows you to understand the code implementation much faster as you do not have to read and understand the
code itself.
Procedure
1. Open the context menu on a DDL source.
Tip
Alternatively, you can also open the graphical editor from the DDL source editor context menu of a CDS entity using
Open With Graphical Editor .
Results
The CDS Graphical Editor is opened and provides a graphical display of the entity as described in the DDL source editor.
Related Information
CDS Graphical Editor
Context
Changes made in the text editor appear immediately in the graphical editor.
Note
Syntax errors appear as parsing errors in the object where the error occurred.
Syntax Errors
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
3. In the context menu of the graphical editor, choose Open DDL Source Editor.
4. Make the required changes to the CDS entity in the source editor.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 26/42
11/21/2019
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
3. In the graphical editor, select the relevant entity and choose Open DDL Source Editor from the context menu.
Context
This feature enables you to view the usage of a user-de ned type within the DDL source.
Procedure
1. Choose a user-de ned type.
2. In the context menu of the user-de ned type, choose the option Highlight Used Columns.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 27/42
11/21/2019
Results
The user-de ned type appears highlighted.
Context
If the data model is so large that not all the objects are visible in the graphical editor at once, you can use the Miniature View to
browse the data model.
Procedure
1. Open a CDS entity in a graphical editor.
Tip
To navigate to Quick Access, you can also press CTRL + 3 .
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 28/42
11/21/2019
Miniature View
Context
You can manually change the position of the objects, but these positions are not persisted. The next time you open the DDL
source, the graphical editor lays out the position of the objects automatically.
If you have manually changed the position of the objects, follow the step below to have the objects positioned automatically.
Procedure
In the context menu of the graphical editor, choose Auto Layout.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 29/42
11/21/2019
Auto Layout
Context
You can print or export object diagrams using the graphical editor.
Procedure
1. To print the graphical representation, select the relevant entity and choose Print from the context menu.
The Print preview and preferences dialog is opened. Here you select the relevant printer and print settings.
2. To export the graphical representation as an image le, select the relevant entity and choose Export from the context
menu.
The Export Diagram dialog is opened. Here you can select the relevant area for the graphical representation as well as the
target le format and its size to be generated as an image le.
Context
Use DCLs to develop access-control logic for Core Data Services (CDS) entities from SAP NetWeaver AS for ABAP. DCLs enable
you to lter access to data in the database based on static values or conditions based on user data (classical authorization
objects). If no DCL document for the CDS entity was created and deployed, a user who can access the CDS entity has access to all
data returned by the entity.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 30/42
11/21/2019
Example
For example, you provide a view of sales orders. You can add a condition that users can only view open sales orders or only
sales orders for companies, which are in the countries that are listed in a classical authorization object.
Tip
We recommend that you protect applications that use CDS entities with classic start authorizations available from SAP
NetWeaver AS for ABAP.
Procedure
1. Create the DCL sources.
Edit DCL source code just as you would DDL source code.
Quick xes
Check the syntax of DCL sources just as you would check the syntax of DDL sources.
Related Information
Creating DCL Sources
Editing DDL Source Code
Checking Syntax of DDL Sources
Activating DDL Sources
Access Control for CDS Entities
Prerequisites
You have the standard developer authorization pro le to create ABAP development objects.
You have created the CDS entities for which you want to restrict access.
Context
A DCL source is an ABAP development object, which supports standard ABAP Workbench functions such as transport, syntax
check, and activation.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 31/42
11/21/2019
Procedure
1. In your ABAP project, select the relevant package node in the Project Explorer.
New Other ABAP Repository Object Core Data Services DCL Source .
3. In addition to the Project and Package, enter the Name and the Description for the DCL source to be created.
4. Choose Next.
6. Choose Next.
Option Description
Use a template. SAP offers example templates for DCL sources. The template
provides you with example coding for you to modify.
Do not use a template. The tool creates an empty DCL source for you to ll.
8. Choose Finish.
Results
In the selected package, SAP NetWeaver AS for ABAP creates an inactive version of a DCL source and stores it in the ABAP
Repository. In the Project Explorer, the new DCL source is added to the Access Control Management Objects folder of the
corresponding package node. As a result of this creation procedure, the DCL source editor is opened. Here, you can start de ning
the role for the CDS entity.
Example
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 32/42
11/21/2019
The following role grants access to entries of the SFlight_Entity CDS entity, which meet the following conditions:
The ConnID of the entry has the same value as is assigned to the user through the PFCG authorization object S_CONNID
in the CONNID eld.
The @MappingRole annotation must have the value true, so this role is assigned to all users in the system. The value false is
not supported.
Related Information
Access Control for CDS Entities
Editing DDL Source Code
Procedure
In the Project Explorer view, open the context menu of a DDL source and choose Open Data Preview.
Note
In addition, you can also open the Data Preview view from the source code editor of a DDL source. Then choose Open
With Data Preview from the context menu.
Results
1. If the CDS View does not require any parameters, the Data Preview displays the result set directly.
2. If the CDS View requires parameters, a dialog to enter parameter values appears:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 33/42
11/21/2019
b. Choose OK.
The Outline view displays parameter values of a CDS View. If you want to modify parameter values, choose the
Parameter option that appears in the Data Preview tool.
Note
If the result set contains less records than you expect, there may be a DCL role for the CDS entity that lters the data returned
by the preview.
Related Information
Activating DDL Sources
Context
You use associations to:
Identify related CDS views. An association lists the hierarchy of related CDS views.
Navigate backwards and view the result sets of the previous CDS view in a hierarchy. Any lters applied to the result sets
are retained.
Procedure
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 34/42
11/21/2019
1. In the Project Explorer view, open the context menu of a DDL source and choose Open Data Preview.
Note
In addition, you can also open the Data Preview view from the source code editor of a DDL source. Then choose Open
With Data Preview from the context menu.
Note
If the selected CDS view requires parameters, a wizard for providing parameter values appears.
The Data Preview tool appears and displays the top 100 records by default.
Note
You can also choose > in the breadcrumb bar to follow an association.
3. Choose an association.
Results
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 35/42
11/21/2019
The Data Preview tool displays the result set for the selected association. You can apply lters to the current result set or use the
breadcrumb to navigate to the previous result set.
You can use the SQL Console option on the Data Preview menu to view the generated Open SQL query for an association. The
generated query uses the SQL view to display records.
Prerequisites
The SQL dependency of data sources can only be calculated for active version of the DDL source.
Context
To open the Dependency Analyzer, proceed as follows:
Procedure
1. In the Project Explorer, select the DDL source that includes the CDS view to be analyzed.
2. Open the context menu and choose Open with Dependency Analyzer .
Tip
Alternatively, you can open the same context menu from the DDL editor of the relevant CDS entity.
Results
The dependency of data sources involved in the CDS view de nition is calculated and displayed in a tree structure ( SQL
Dependency Tree tab).
Related Information
Dependency Analyzer View
Prerequisites
The DDL source you are currently editing has already been activated.
Context
You can open the Active annotations view from the Project Explorer as follows:
Procedure
1. Open the context menu on a DDL source.
Note
Alternatively, you can open the same context menu from the DDL editor of a CDS view.
Results
The Active Annotations view is opened in the structured mode. It displays all the CDS annotations that are de ned in the CDS
view itself or are inherited from the underlying data sources or data elements.
Related Information
Active Annotations View
Identi ers
Identi ers are case-insigni cant; for example, if two view entities are named myView and MYVIEW, respectively, there will
be a naming con ict.
Literals
Only single quotes are allowed for string literals.
Comments
Double slashes ('//') start a comment from the token to the end of the line.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 37/42
11/21/2019
'/*' and '*/' delimit multi-line and inline comments.
Delimiters
Statements may be terminated with a semi-colon ';' .
Annotations and their values can be de ned in the CDS view itself or inherited from the underlying data sources or data elements.
Annotation values are only inherited for elements ( elds and associations) and parameters. Parameters can only inherit from the
corresponding data elements, not from underlying data sources.
Annotated Elements: The view, its parameters, elds, and associations, and their active CDS annotations.
Origin Data Source: Name of the development object, for example, a DDL source or database table from which the
corresponding annotation is inherited. You can navigate to this object by double-clicking its name.
Origin Data Element: Name of the data element from which the corresponding annotation is inherited. You can navigate to
this object by double-clicking its name.
Enter a lter text in the search eld to display speci c entries in the Annotated Elements column.
Toggle between the at or structured display of the active annotations. The structured mode groups the CDS annotations
by their parent node and is set by default. To switch the display mode, choose the arrow button from the view toolbar and
select the relevant entry.
Related Information
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 38/42
11/21/2019
Displaying The Annotation Values of an Active CDS View
This means, you can see which database tables are used by your query to select data from the database and you can easily
identify redundant joins which might negatively affect the performance of your query.
The Dependency Analyzer recursively analyzes the data sources and also displays the indirect dependencies to other database
objects in the SQL Dependency Tree tab.
The data sources involved are determined recursively and the result is displayed in a tree structure. As data sources, the following
entities are possible:
CDS Views
Database Views
Database Tables
(SELECT) FROM
Refresh the dependency tree, for example, after modi cations have been made and the source has been activated
Navigate to the listed data sources through double-click or using the context menu
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 39/42
11/21/2019
Search for data sources within the tree structure
Example
As a developer who implements CDS views, you may not always be aware of the real JOIN behavior of the view de nitions at
database level – For example, the number of JOINs generated when you use Associations in a CDS view.
Related Information
Analyzing Dependencies in Complex CDS Entities
The editor allows you to understand the code implementation much faster as you do not have to read and understand the code
itself.
In the CDS Graphical Editor, the following graphical representations of CDS entities are provided:
Symbol Description
Represents an entity
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 40/42
11/21/2019
Symbol Description
Note
This line indicates the relationship between entities. The
association name appears on the line. It also displays the
cardinality if you have de ned cardinality for the association.
Indicates a union
The CDS Graphical Editor provides you with the following options:
Make changes to the CDS entities in the source code editor and view the changes in the graphical editor
Related Information
Working with the Graphical Editor
Glossary
Core Data Services (CDS)
CDS introduce a common set of domain-speci c languages (DSL) and services for de ning and consuming semantically rich data
models.
CDS Entity
Part of a DDL source
The de nition of a CDS entity is introduced with the DEFINE VIEW statement. A CDS entity is used to specify the structure of an
SQL view.
DCL Editor
Text-based editor for editing DCL sources
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 41/42
11/21/2019
The DCL editor is part of ABAP Development Tools and allows you to de ne the role or access policy for the CDS entity.
DCL Source
ABAP development object that is used to de ne authorizations for CDS entities
A DCL source allows you to limit the results returned by a CDS entity to those you authorize a user to see.
DDL statements are used to create and delete the entities of a relational database. In AS ABAP, DDL is integrated into ABAP
Dictionary.
DDL Editor
Text-based editor for editing DDL sources
DDL Source
ABAP development object that is used to de ne a CDS view entities
A DDL source is created in ABAP Repository using a wizard of ABAP Development Tools.
SQL View
Projection onto one or multiple relational database tables or other views
An SQL view is generated in the ABAP Dictionary after activation of the DDL source. The structure of an SQL view is de ned in a
CDS entity. SQL view is a technical representation of the CDS entity.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=21801752&topics=4ed1f2e06e391014adc9fffe4e2… 42/42