Skip to Content
Technical Articles
Author's profile photo Sanjeev Kumar

Part#5. CDS View Extension

SAP provides multiple standard CDS view related to each functional module and also during a project implementation you will create tons of CDS custom views.  Since the CDS views are just virtual data models, you will want to reuse the view created in one project or for one object to another project/object.  Let’s assume you created a CDS view with 5 fields on TABLE A and for another scenario in a different project you need 8 fields from the same TABLE A.  So instead of creating new CDS view from scratch, we can use the concept of CDS View extension and re-use the previous view we created and extend it with 3 new fields.

  1. Create a CDS view with Template ‘Extend View’

 

 

Below is the default view generated;

 

Now add the SQL view name and other properties;

  1. SQL View name: ZSQL_EXTEND_VIEW
  2. Let’s extend the view we created before: ZCDS_BASIC_VIEW. This could be a standard view as well.  Any view which you would like to extend with new fields.
  3. Hit CTRL + SPACE to see the fields which you would like to extend with. This will use the datasource/table used in the view we are extending i.e. table SFLIGHT in our case.

Add the fields you would like to extend and ‘Activate’ the view.

 

Hit F8 and check the output.  You can see that the 3 new fields are available in this view together with all other fields of the view we extended;

Hit F8 and check the output.  You can see that the 3 new fields are available in this view together with all other fields of the view we extended;

 

In summary, we looked at the re-usability concept in this blog post, which is very important to reduce the development effort and to follow the Best SAP Practices as well.  Instead of creating from scratch, it is highly important to know about SAP delivered standard CDS views to re-use them in your project to meet specific business requirements.

My next blog post will be about:

Part# 6. Parameters in a CDS view : Learn how to filter data in a CDS view

 

Follow me for upcoming blog posts: Sanjeev Kumar

Keep learning..

SK

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mauricio Miao
      Mauricio Miao

      Hi Sanjeev Kumar,

      I have a customer that is facing an issue during un SP update of his S/4HANA 1909 system because there is a standard view which were extended using this technique.

      SUM stopped during step EU_CLONE_CRE_SHDVIEWS.

      So I think we should avoid it in order to preserve the core integrity.

      Regards

      Mauricio

       

       

      Author's profile photo Rose Aparicio
      Rose Aparicio

      Hi Mauricio Miao ,

       

      Was there any workaround from SAP on your issue?

      I have a similar requirement: We have an E-Ledger ACR report that the customer wants to add Customer and Vendor Name in the output. Unfortunately, the view name  I_TR_StRpElectronicLedgerItem is not on the registry SCFD_REGISTRY so I cannot use Key User Extensibility but do it Manual Extensibility using Eclipse.

       

      Looking forward for your feedback.
      Thank you!

       

      Author's profile photo Mauricio Miao
      Mauricio Miao

      Hi Rose Aparicio,

      No workaround, we deleted the extension to solve the issue.

      Regards

      Mauricio

      Author's profile photo Martin Sautter
      Martin Sautter

      Hi Kumar,

      ...and now  "backwards":

      How to find (all) the extension to an CDS ?

      For ex:

      Given is a CDS for ex. I_PRODUCT - which extension does this CDS has ?

       

      Best Martin