Get Example source ABAP code based on a different SAP table
ABAP_CDS - DDIC-Based Entities (Obsolete) It is still possible, but not recommended, to create DDIC-based entities. SAP recommends creating CDS view entities instead of CDS DDIC-based views. A CDS DDIC-based entity> is a CDS entity> for which a ABAP_CDS_MNG_VIEW > is created in the ABAP Dictionary alongside the CDS entity upon activation. Therefore , DDIC-based entities> are not exclusively CDS entities, but also DDIC artefacts (see image below). There is only one kind of DDIC-based entity available, namely ABAP_CDS_V1_VIEWS >. IMAGE ABDOC_DDIC_VIEW_2.png 450 140 A ABAP_CDS_V1_VIEW > is defined using the statement DEFINE VIEW>>. This kind of CDS view> was first released with release ABAP_740_SP05 and it was for many years the only available kind of CDS view. Since release ABAP_780 , CDS view entities > are available. They are defined using the statement DEFINE VIEW ENTITY>. They have evolved from ABAP_CDS_V1_VIEWS >, serve the same purpose and have the same structure as their predecessor. But they offer several advantages over the classic> ABAP_CDS_V1_VIEWS >:
No additional DDIC view is created upon activation
Improved performance during view activation
Optimization and simplification of syntax
Stricter syntax checks indicate problematic situations more explicitly (for example, annotation checks) A complete and exhaustive list of new features, improvements, and differences is provided in the following blog series: CDS view entities are feature complete. Overview of new features, improvements, and differences>. For these reasons, it is recommended that CDS view entities> are created instead of ABAP_CDS_V1_VIEWS > when a new CDS view is required. ABAP_CDS_V1_VIEWS > are still supported to ensure downward compatibility. IMAGE ABDOC_V1_V2.png 524 128 BEGIN_SECTION VERSION 5 OUT
Migration The documented ABAP program RUTDDLS_MIGRATION_CANDIDATES>> can be used to evaluate whether a migration from a ABAP_CDS_V1_VIEW to a CDS view entity is possible. This can be done, for example, as part of a manual migration. The documented ABAP program RUTDDLSV2MIGRATION>> automates many steps required for migrating ABAP_CDS_V1_VIEWS to CDS view entities. The ABAP program RUT_WHERE_USE_SQLVIEW>> lists all repository objects> that use CDS-managed DDIC views>. Using CDS-managed DDIC views has been declared obsolete> and this tool helps in adjusting coding. This is useful, for example, when CDS views are migrated to CDS view entities and the CDS-managed DDIC-view is deleted as part of the migration. Details on migration and the available tools are described in the following blog post: A new generation of CDS views: how to migrate your CDS views to CDS view entities>, END_SECTION VERSION 5 OUT
ABAP_EXAMPLE_VX5
The CDS view DEMO_CDS_SCARR_SPFLI>> shown below is a ABAP_CDS_V1_VIEW >.
The second view shown below, DEMO_CDS_SCARR_SPFLI_2>>, is a CDS view entity> and it uses the new syntax DEFINE VIEW ENTITY>.
The syntax differs slightly: the second view does not have the annotation @AbapCatalog.sqlViewName>, because it does not have any DDIC view (the SQL view of the database is derived directly from the definition). Moreover, name lists are not supported and the element names are specified with the keyword AS> instead.
The class CL_DEMO_CDS_DDIC_VS_VIEW_ENTTY>> uses SELECT> to access both views. The result is exactly the same. DDLS DEMO_CDS_SCARR_SPFLI DDLS DEMO_CDS_SCARR_SPFLI_2 ABAP_EXAMPLE_END