New ABAP CDS Tools in SAP NetWeaver AS ABAP 7.5
SAP NetWeaver AS ABAP 7.5 delivers many new features in the area of ABAP Core Data Services (ABAP CDS). In addition to the new CDS language features there are also many new CDS tools in ABAP in Eclipse. Here is a short overview of some of the tooling highlights.
If you’re looking for your DDL sources in 7.5 you will now find them in your ABAP package under Core Data Services > Data Definitions. The CDS objects have been re-organised in the Project Explorer to make accessing your objects easier.
Code completion in ADT and in the context of the CDS text editor is certainly nothing new. What is new is that you can now insert all the elements of the data sources into the select list of your CDS view definition with one completion. Trigger the code completion with CTRL+SPACE and choose “Insert all elements”. In addition to the fields, any public associations defined in the data sources are also added to the select list. The completion takes into consideration all data sources, including the joined data sources. After the insertion you can easily delete individual elements from the select list with the Eclipse keyboard shortcut CTRL+D (delete line).
There is also code completion support for the CDS predefined functions (SQL, conversion, date and time functions).
On Clause Wizard
Code completion is great, but sometimes a wizard just gets the job done better. With the On Clause Wizard you can easily create the ON clauses of your SQL joins and your association definitions. To start the wizard place the cursor on the ON keyword and use the keyboard shortcut CTRL+1. Choose “Define ON conditions”. Create the conditions by mapping the fields of the source data sources (left hand side) with the target data source (right hand side) using drag & drop. Use the Filter to quickly find corresponding fields in the data sources by name or by type. The wizard also offers some pre-defined strategies to automatically generate the mappings. The mappings can be generated “By Name” or, if your sources are database tables, “By Foreign Key”. In this case, any foreign key definitions stored in the ABAP Dictionary for the database tables can be used to generate the mappings.
Active Annotations View
In addition to the “core” annotations supported in SAP NetWeaver AS ABAP 7.4, there are now many more domain-specific annotations which you can use in your CDS view definitions. These annotations can be used for OData exposure and analytical consumption of CDS views. If you have defined view hierarchies (“view on view”) then the element annotation values are propagated from the underlying views to the view above. If you want to know which annotations your view contains (including the propagated annotations) and where the individual annotation values originated from, then you can use the Active Annotations View. Start the view in the context menu of the DDL source: Open With > Active Annotations. For each annotation the value and the origin is displayed. Navigate to the origin by double clicking on the data source or data element name.
Show SQL CREATE Statement
If you want to see which SQL joins were generated in the database system for the path expressions in your view definitions or if you want to see the order of the generated joins, then you can easily display the CREATE statement for the corresponding SQL view directly in ADT. Select “Show SQL CREATE Statement” in the context menu of the DDL source.
Another useful tool to help you analyze the dependencies of your CDS view is the Dependency Analyzer. While the CREATE statement only displays the direct dependencies, the Dependency Analyzer recursively analyzes the data sources and also displays the indirect dependencies to other database objects in the SQL Dependency Tree. In the Dependency Analyzer 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. Start the Dependency Analyzer in the context menu of the DDL source: Open With > Dependency Analyzer. Search for database objects by entering the SQL name in the Search Toolbar. Navigate to the objects by double clicking on the SQL name. Finally, you can export the contents of the SQL Dependency Tree to a CSV file to analyze the dependencies in another external tool.