Beruflich Dokumente
Kultur Dokumente
The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help
Portal.
Note
This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.
© 2016 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. The information contained herein may be changed without prior notice. 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 are
provided by SAP SE and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP
Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group 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. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE in
Germany and other countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.
Table of content
PUBLIC Page 1 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Table of content
1 About the ABAP CDS Development User Guide
2 Concepts
2.1 ABAP CDS Entities
2.1.1 ABAP CDS Views
2.1.2 ABAP CDS Table Functions
2.2 Access Control for CDS Entities
3 Tasks
3.1 Creating DDL Sources
3.2 Activating DDL Sources
3.2.1 Displaying Activation Log for DDL Sources
3.3 Editing DDL Source Code
3.3.1 Getting Help for DDL Sources
3.3.2 Getting Support from Content Assist
3.3.3 Using DDL Code Templates
3.3.4 Navigating Associations
3.3.5 Applying Quick Fixes
3.3.6 Defining ON Conditions by Use of a Wizard
3.3.7 Adding and Removing Comments
3.3.8 Changing Colors for DDL Sources
3.3.9 Comparing DDL Source Code Versions
3.3.10 Displaying CDS View Extensions
3.3.11 Checking Syntax of DDL Sources
3.4 Working with the Graphical Editor
3.4.1 Displaying the Graphical Representation of DDL Source Code
3.4.2 Updating the Graphical Representation of a CDS Entity
3.4.3 Opening a CDS Entity in the Source-Based Editor
3.4.4 Highlighting Used Columns
3.4.5 Navigating Through Data Models
3.4.6 Positioning Objects Automatically in the CDS Source Editor
3.4.7 Printing and Exporting Diagrams
3.5 Adding Access Control to CDS Entities
3.5.1 Creating DCL Sources
3.6 Previewing Data Records
3.7 Working with Associations in the CDS Data Preview
3.8 Analyzing Dependencies in Complex CDS Entities
3.9 Displaying The Annotation Values of an Active CDS View
4 Reference
4.1 General DDL Syntax Rules
4.2 Active Annotations View
4.3 Dependency Analyzer View
4.4 CDS Graphical Editor
4.5 Glossary
5 What's New in ABAP CDS Tools
5.1 Version ADT 2.54
5.2 Version ADT 2.51
5.3 Version ADT 2.41
5.4 Version ADT 2.31
5.5 Version ADT 2.19
PUBLIC Page 2 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
1 About the ABAP CDS Development User Guide
Scope of Documentation
This documentation describes the functionality and usage of tools for Core Data Services (CDS) within ABAP development for SAP HANA scenarios. In
particular, it focuses on use cases for creating, editing, testing, and analyzing ABAP CDS entities - starting from the Eclipse-based IDE.
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 find further resources on how ABAP-based applications can
leverage SAP HANA.
Overview
ABAP CDS provides a framework for defining and consuming semantic data models on the central database of the application server AS ABAP. The specified
data models are based on the data definition language (DDL) and the data control language (DCL). So, a CDS entity or the enhancement of a CDS view is
defined as source code in the CDS data definition.
The following types of ABAP CDS entities are supported:
ABAP CDS Views
ABAP CDS Table Functions
Remember
In the DDL editor, you can only define one ABAP CDS entity in one DDL source.
Related Information
ABAP CDS in ABAP Dictionary
Overview
ABAP CDS provides a framework for defining and consuming semantic data models on the central database of the application server AS ABAP. The specified
data models are based on the data definition language (DDL) and the data control language (DCL). So, a CDS entity or the enhancement of a CDS view is
defined as source code in the CDS data definition.
The following types of ABAP CDS entities are supported:
ABAP CDS Views
ABAP CDS Table Functions
PUBLIC Page 3 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
ABAP Development Tools.
Remember
In the DDL editor, you can only define one ABAP CDS entity in one DDL source.
Related Information
ABAP CDS in ABAP Dictionary
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 defines 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.
Example
CLASS cl_demo_access_cds_entity IMPLEMENTATION.
...
METHOD get_data.
PUBLIC Page 4 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
INTO TABLE @DATA(result_data)
WHERE ... .
ENDMETHOD.
...
ENDCLASS.
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
2. Defining a CDS view
See also: Editing DDL Source Code
3. Adding Access Control to CDS Entities
4. Checking Syntax of DDL Sources
5. Activating DDL Sources
6. [Optional:] Previewing Data Records
7. [Optional:] Analyzing the SQL dependency tree of the view in case of more complex CDS views
See also: Analyzing Dependencies in Complex CDS Entities
8. [Optional:] Analyzing associations between views
See also: Working with Associations in the CDS Data Preview
9. [Optional:] Analyzing the relationship between views in a graphical tool in case of more complex views
See also: Displaying the Graphical Representation of DDL Source Code
10. [Optional:] Deleting DDL Sources
Caution
Before deleting a DDL Source, check whether it is still being used by other development objects. To find 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
PUBLIC Page 5 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
2.1.2 ABAP CDS Table Functions
ABAP CDS table functions define table functions that are implemented natively on the database and can be called in CDS. As such, they support the HANA
platform code pushdown capabilities in ABAP CDS.
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.
Note
The name of the implementing AMDP method can only be specified in a single CDS table function (1: 1 relation).
Example
Table Function Definition
In the following listing, a client-specific ABAP CDS table function TAB_FUNCTION_EXAMPLE is defined using the DDL syntax. This table function declares
two input parameters clnt (with the predefined 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
PUBLIC Page 6 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
implemented by method CL_EXAMPLE_AMDP=>GET_FLIGHTS;
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 thetable
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
class cl_example_amdp definition public.
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
2. Defining a CDS table function
See also: Editing DDL Source Code
3. Adding Access Control to CDS Entities
4. Checking Syntax of DDL Sources
5. Activating DDL Sources
6. Implementing a CDS table function in the AMDP class
7. Debugging CDS Table Functions
See also: Debugging AMDPs
Related Information
ABAP CDS Synatx – Table Functions
PUBLIC Page 7 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
2. Does the current user have the required authorizations?
If a role is defined 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 fills 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 first 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 defined by the data model and the data in question).
Related Information
Adding Access Control to CDS Entities
ABAP CDS - Access Control
Prerequisites
You need the standard developer authorization profile to create ABAP development objects.
Context
A DDL source allows you to define 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
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 .
PUBLIC Page 8 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 1: Wizard page when creating a DDL source
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 defining a CDS entity.
Related Information
ABAP CDS Entities
ABAP Development Objects
Editing DDL Source Code
Prerequisites
You need the standard developer authorization profile to create ABAP development objects.
Context
A DDL source allows you to define 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
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 .
PUBLIC Page 9 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 1: Wizard page when creating a DDL source
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 defining a CDS entity.
Related Information
ABAP CDS Entities
ABAP Development Objects
Editing DDL Source Code
Prerequisites
Make sure that the DDL source you wish to activate is syntactically correct. The system performs a syntax check of the entire object before it is activated.
Context
To generate a CDS view, you must activate the DDL source.
Procedure
To activate the DDL source from the DDL source editor ...
1. Open the relevant DDL source in the DDL editor.
2. Click the icon ( Activate the ABAP Development Object ) in the toolbar.
Tip
Alternatively, you can use the keyboard shortcut Ctrl + F3.
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
PUBLIC Page 10 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Previewing Data Records
Note
For details, see also: Troubleshooting for Dictionary Activation Errors
Sub Topics
Getting Help for DDL Sources
Getting Support from Content Assist
Applying Quick Fixes
Using DDL Code Templates
Adding and Removing Comments
Changing Colors for DDL Sources
Comparing DDL Source Code Versions
Displaying CDS View Extensions
Tip
In addition, you will find the complete CDS Language Reference on the SAP Help Portal.
PUBLIC Page 11 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
In the DDL source editor, move the cursor to the element of your interest and choose F2.
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 defined for the table fields.
PUBLIC Page 12 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
3.3.2 Getting Support from Content Assist
In the DDL source editor, the content assist proposes valid DDL keywords and identifiers to you that can be inserted within the source code at your current
position. Consequently, you can reduce the time spent on code editing and ensure that you are using the valid source code elements.
The following help is provided by the content assist:
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.
Figure 2: 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 first 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.
PUBLIC Page 13 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 4: Completion of elements in the DDL editor
To use a template...
1. In the DDL source editor, write the beginning characters of the template.
2. Select Ctrl + Space (code completion).
Tip
Alternatively, you can use the Templates view to insert the template code in the DDL source using Drag & Drop.
Tip
If you want to add the new template to the DDL source creation wizard, select DDL (creation) as the Context .
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 definition within the same DDL source. In both
cases, the selected occurrences and names are highlighted.
PUBLIC Page 14 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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
Prerequisites
This function affects the CDS view in the currently opened editor.
Context
You can use the ON conditions wizard when defining:
Joins between two data sources (JOIN condition) in a CDS view.
Conditions for association in a SELECT statement.
PUBLIC Page 15 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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 Defined 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 define an ON condition for a join or association.
3. Press CTRL + 1 key shortcut.
Figure 1: Starting the ON conditions wizard from the quick fix view
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, define 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 defined for a table in the ABAP Dictionary, mappings are
suggested for each key definition.
When using the User Defined 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:
Filter the data sources and their elements by
Name
Dictionary type
Built-in type
Expand or collapse all elements of the
$parameter
$projection
data source
Access context menu functions to...
Delete a selected condition
Delete all conditions
Restore the initial mapping
Tip
To open the context menu on the wizard page, select the relevant element from the Source or Target area.
PUBLIC Page 16 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 2: 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
The wizard does not check the syntax or semantic correctness of a CDS view. So, the modified coding might contain syntax or semantic errors.
Related Information
ABAP CDS – SELECT, Association
ABAP CDS – SELECT, JOIN
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.
Ctrl + 7 Toggle Comment The editor inserts or removes a double slash asterisk
(//) 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... )
Context
The source code editor displays the DDL source code and annotation types with predefined colors. However, you can change these default settings to adapt
them to your personal needs. You can define the color for displaying the keywords, identifiers, annotation, or further code elements in DDL source code.
Procedure
1. Open the General Appearance Colors and Fonts preference page.
2. Expand the folders CDS DDL .
PUBLIC Page 17 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
2. Expand the folders CDS DDL .
3. Select the text type you want to change and click the Edit... button.
4. Select the color and confirm with OK .
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.
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 definitions of the view extensions that exist in the
system.
Context
With the editor check function, you can check whether the source code of DDL sources is syntactically correct or not.
To enable the check function, there are two options available:
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.
To trigger an explicit syntax check, proceed as follows:
PUBLIC Page 18 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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 fix for that
specific error item.
Figure 2: 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
PUBLIC Page 19 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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
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.
2. Choose Open With Graphical Editor .
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.
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.
5. Choose the graphical editor view to see the changes.
PUBLIC Page 20 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
This functionality allows you to open the source code editor of a CDS entity from a graphical editor.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
Results
The user-defined type appears highlighted.
PUBLIC Page 21 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Navigating Through Data Models
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.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
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 .
PUBLIC Page 22 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 5: 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 file, 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 file format and its size
to be generated as an image file.
Related Information
CDS Graphical Editor
3.4.1 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
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.
2. Choose Open With Graphical Editor .
PUBLIC Page 23 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
The Graphical Editor is opened.
3. In the graphical editor, select the relevant entity and choose Open DDL Source Editor from the context menu.
PUBLIC Page 24 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 2: Opening DDL Source Editor
Context
This feature enables you to view the usage of a user-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
Results
The user-defined 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.
PUBLIC Page 25 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Procedure
1. Open a CDS entity in a graphical editor.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
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 .
PUBLIC Page 26 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Printing and Exporting Diagrams
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 file, 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 file format and its size
to be generated as an image file.
Related Information
CDS Graphical Editor
Displaying the Graphical Representation of DDL Source Code
3.4.2 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
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.
2. Choose Open With Graphical Editor .
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
PUBLIC Page 27 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
PUBLIC Page 28 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 3: Highlighting Used Columns
Results
The user-defined 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.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
PUBLIC Page 29 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Positioning Objects Automatically in the CDS Source Editor
The graphical editor positions the objects in the editor automatically.
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 .
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 file, 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 file format and its size
to be generated as an image file.
Related Information
CDS Graphical Editor
Displaying the Graphical Representation of DDL Source Code
Updating the Graphical Representation of a CDS Entity
3.4.3 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
PUBLIC Page 30 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Displaying the Graphical Representation of DDL Source Code
The CDS Graphical Editor provides an overview of the various entities and their relationships in graphical format.
Context
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.
2. Choose Open With Graphical Editor .
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
PUBLIC Page 31 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
Results
The user-defined 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.
PUBLIC Page 32 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Procedure
1. Open a CDS entity in a graphical editor.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
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 .
PUBLIC Page 33 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Printing and Exporting Diagrams
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 file, 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 file format and its size
to be generated as an image file.
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
3.4.4 Highlighting Used Columns
Navigating Through Data Models
Positioning Objects Automatically in the CDS Source Editor
Printing and Exporting Diagrams
Context
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.
2. Choose Open With Graphical Editor .
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
PUBLIC Page 34 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
PUBLIC Page 35 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 3: Highlighting Used Columns
Results
The user-defined 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.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
PUBLIC Page 36 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Positioning Objects Automatically in the CDS Source Editor
The graphical editor positions the objects in the editor automatically.
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 .
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 file, 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 file format and its size
to be generated as an image file.
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
3.4.5 Navigating Through Data Models
Positioning Objects Automatically in the CDS Source Editor
Printing and Exporting Diagrams
PUBLIC Page 37 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Displaying the Graphical Representation of DDL Source Code
The CDS Graphical Editor provides an overview of the various entities and their relationships in graphical format.
Context
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.
2. Choose Open With Graphical Editor .
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
PUBLIC Page 38 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
Results
The user-defined 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.
PUBLIC Page 39 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Procedure
1. Open a CDS entity in a graphical editor.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
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 .
PUBLIC Page 40 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Printing and Exporting Diagrams
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 file, 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 file format and its size
to be generated as an image file.
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
3.4.6 Positioning Objects Automatically in the CDS Source Editor
Printing and Exporting Diagrams
Context
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.
2. Choose Open With Graphical Editor .
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
PUBLIC Page 41 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
PUBLIC Page 42 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 3: Highlighting Used Columns
Results
The user-defined 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.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
PUBLIC Page 43 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Positioning Objects Automatically in the CDS Source Editor
The graphical editor positions the objects in the editor automatically.
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 .
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 file, 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 file format and its size
to be generated as an image file.
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
3.4.7 Printing and Exporting Diagrams
PUBLIC Page 44 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Displaying the Graphical Representation of DDL Source Code
The CDS Graphical Editor provides an overview of the various entities and their relationships in graphical format.
Context
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.
2. Choose Open With Graphical Editor .
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.
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.
5. Choose the graphical editor view to see the changes.
Procedure
1. Choose a CDS entity.
2. In the context menu of the CDS entity, choose Open With Graphical Editor .
PUBLIC Page 45 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
The Graphical Editor is opened.
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-defined type within the DDL source.
Procedure
1. Choose a user-defined type.
2. In the context menu of the user-defined type, choose the option Highlight Used Columns .
Results
The user-defined 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.
PUBLIC Page 46 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Procedure
1. Open a CDS entity in a graphical editor.
2. Choose the Quick Access field.
Tip
To navigate to Quick Access , you can also press CTRL + 3.
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 .
PUBLIC Page 47 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Printing and Exporting Diagrams
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 file, 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 file format and its size
to be generated as an image file.
Prerequisites
You have the standard developer authorization profile to create ABAP development objects.
Context
Use DCLs to develop access-control logic for Core Data Services (CDS) entities from SAP NetWeaver AS for ABAP. DCLs enable you to filter 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.
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.
2. Edit the DCL source code.
Edit DCL source code just as you would DDL source code.
There is no support for the following:
Quick fixes
Adding and removing comments
Comparing DCL source code versions
3. Check the syntax of DCL sources
Check the syntax of DCL sources just as you would check the syntax of DDL sources.
4. Activate DCL sources.
Activate DCL sources just as you would activate DDL sources.
Activation logs for DCL sources are not supported.
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 profile to create ABAP development objects.
You have created the CDS entities for which you want to restrict access.
PUBLIC Page 48 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Context
A DCL source is an ABAP development object, which supports standard ABAP Workbench functions such as transport, syntax check, and activation.
Procedure
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 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 .
5. Assign a transport request.
6. Choose Next .
7. Determine if you want to use a template for the DCL source.
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 fill.
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 defining the role for the CDS entity.
Example
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 field.
The CarrID of the entry has the value LH.
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.
@EndUserText.label: 'Show only flights for which the carrier ID is LH'
@MappingRole: true
define role Sflight1 {
grant select on SFlight_Entity
where ( ConnID ) = aspect pfcg_auth( S_CONNID, CONNID) AND CarrID ='LH';
}
Related Information
Access Control for CDS Entities
Editing DDL Source Code
PUBLIC Page 49 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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:
Note
If the result set contains less records than you expect, there may be a DCL role for the CDS entity that filters 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 filters applied to the result sets are retained.
Procedure
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.
2. In the table context menu, choose Follow Association .
PUBLIC Page 50 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Note
You can also choose > in the breadcrumb bar to follow an association.
3. Choose an association.
Results
The Data Preview tool displays the result set for the selected association. You can apply filters 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 .
PUBLIC Page 51 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
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 definition 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.
2. Choose Open with Active Annotations .
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 defined in the CDS view itself or are inherited from
the underlying data sources or data elements.
Related Information
Active Annotations View
Keywords
Keywords must be written all-uppercase, all-lowercase, or capitalized; for example KEYWORD, keyword, and Keyword are all valid notations for the
same keyword, but keyWord and KeyWord will cause a syntax error.
Identifiers
Identifiers are case-insignificant; for example, if two view entities are named myView and MYVIEW, respectively, there will be a naming conflict.
The maximum length of identifiers is 30 characters.
Literals
Only single quotes are allowed for string literals.
Numbers cannot be abbreviated; for example .5 is not allowed for 0.5.
Comments
Double slashes ('//') start a comment from the token to the end of the line.
'/*' and '*/' delimit multi-line and inline comments.
PUBLIC Page 52 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Delimiters
Statements may be terminated with a semi-colon ';' .
Keywords
Keywords must be written all-uppercase, all-lowercase, or capitalized; for example KEYWORD, keyword, and Keyword are all valid notations for the
same keyword, but keyWord and KeyWord will cause a syntax error.
Identifiers
Identifiers are case-insignificant; for example, if two view entities are named myView and MYVIEW, respectively, there will be a naming conflict.
The maximum length of identifiers is 30 characters.
Literals
Only single quotes are allowed for string literals.
Numbers cannot be abbreviated; for example .5 is not allowed for 0.5.
Comments
Double slashes ('//') start a comment from the token to the end of the line.
'/*' and '*/' delimit multi-line and inline comments.
Delimiters
Statements may be terminated with a semi-colon ';' .
PUBLIC Page 53 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
its name.
Here you can:
Enter a filter text in the search field to display specific entries in the Annotated Elements column.
Toggle between the flat 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
Displaying The Annotation Values of an Active CDS View
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
CDS Table Functions
Database Views
Database Tables
The following relations are considered in the dependency tree:
(SELECT) FROM
Joins: INNER, LEFT OUTER, RIGHT OUTER
Joins resulting from using Associations
Set operations: UNION, UNION ALL
This view also provides you with additional functionality to:
Refresh the dependency tree, for example, after modifications have been made and the source has been activated
Expand/collapse all nodes in the tree structure
Navigate to the listed data sources through double-click or using the context menu
Export the dependency tree into a local CSV file
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 definitions 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
PUBLIC Page 54 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
Figure 1: Example of a data source structure displayed in the CDS Graphical Editor
In the CDS Graphical Editor , the following graphical representations of CDS entities are provided:
Symbol Description
Represents an entity
Note
This line indicates the relationship between entities. The association name
appears on the line. It also displays the cardinality if you have defined
cardinality for the association.
Indicates a union
The CDS Graphical Editor provides you with the following options:
View CDS entities in a source code editor
Make changes to the CDS entities in the source code editor and view the changes in the graphical editor
View usage of a user-defined type within a DDL source
Navigate within a data model
Auto layout objects in the editor
Related Information
Working with the Graphical Editor
4.5 Glossary
CDS Entity
Part of a DDL source
The definition of a CDS entity is introduced with the DEFINE VIEW statement. A CDS entity is used to specify the structure of an SQL view.
PUBLIC Page 55 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
DCL Editor
Text-based editor for editing DCL sources
The DCL editor is part of ABAP Development Tools and allows you to define the role or access policy for the CDS entity.
DCL Source
ABAP development object that is used to define 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 Editor
Text-based editor for editing DDL sources
The DDL editor is part of ABAP Development Tools.
DDL Source
ABAP development object that is used to define 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 defined in a CDS entity. SQL view is a
technical representation of the CDS entity.
PUBLIC Page 56 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
5.2 Version ADT 2.51
Here is an overview of the most significant changes in the context of CDS view building tools that relate to the:
Back end: SAP NetWeaver Release 7.50 SP00
Client: ABAP Development Tools (ADT) 2.51
Sample Code
@ClientDependent: true
Tool Support
The DDL editor provides support for:
Opening an object ( CTRL + SHIFT + A) for table functions
Defininig table functions with parameters by the help of a creation template
Code completion for
Keywords
Annotations
Data types in parameter definitions and in field definitions (both built-in and DDIC types)
Name of the implementing class/implementing method
Navigation to (F3)
Implementing class
Implementing method
DDIC types used in field/parameter definitions
Navigation from implementing class (definition part to table function)
Element info for
Table functions (triggered with F2 in the DDL source itself, not in the ABAP class)
DDIC types used in field/parameter definitions
Sample Code
@AbapCatalog.sqlViewAppendName: 'DEMO_CDS_EXTENS'
extend view demo_cds_original_view with demo_cds_view_extension
{ spfli.distance,
spfli.distid as unit };
Tool Support
The DDL editor provides support for:
EXTEND VIEW with the help of a creation template
Code completion for
Associations defined in the base view (public and private associations)
Associations defined in EXTEND VIEV
Including associations of the base view when triggering Insert all elements in the code completion in the EXTEND VIEW
Navigation from the usage of the association in the EXTEND VIEW to its definition in the base view (CTRL + click) or its target (CTRL + click )
Displaying the associations that have been added in the EXTEND VIEW in the element info of the base view.
Defining ON Conditions
You can now apply a wizard for defining ON conditions in JOIN clauses and ASSOCIATION definitions of your CDS view definition.
For more information, look here:
Defining ON Conditions by Use of a Wizard
Dependency Analyzer
When implementing the view on view pattern, the relations between the resulting data sources can become very complex. The Dependency Analyzer aims
to give the CDS developer a better overview of the complexity of the SQL behavior so that this complexity might be reduced and/or superfluous JOINs might
be found.
For more information, look here:
Analyzing Dependencies in Complex CDS Entities
SQL Console
You can use the SQL Console tool to write an SQL statement and analyze the query performance. It enables you to execute arbitrary SELECT statements
on the database without writing any ABAP report.
To open the SQL Console tool, select the relevant ABAP Project in the Project Explorer . Then open the context menu of the project and choose the SQL
Console menu item.
Tip
Aletrnatively, you can open the SQL Console wrom within the Data Preview tool. In that case, the data preview automatically generates you the
corresponding SQL statement according to your filter settings.
PUBLIC Page 59 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.
5.5 Version ADT 2.19
As a part of Core Data Services (CDS) feature, the ABAP Development Tools (ADT) provides some extended tool functions for defining CDS entities.
Backend: SAP NetWeaver 7.4 SP5
Client: ABAP Development Tools (ADT) 2.19
PUBLIC Page 60 of 60
© 2014 SAP SE or an SAP affiliate company. All rights reserved.