Skip to Content

♦ Introduction

In this post I would like to share an short real project example and that could be usefull for ABAP CDS view developers. Main idea of current post: The devil is in the details or without literary style: Some seemingly unimportant annotations in ABAP CDS views could be very important!

I am using S/4HANA 1610 with NW 7.51 for creation a demonstration examples.

♦ Imagine this steps of development process…

  • Suppose we have a ABAP CDS view with cube data category. Basic CDS view for it is based on ACDOCA table.
  • One of field in this CDS view is ACDOCA-ZUONR represented Internal contract number.
  • We need to make contract attributes, like contract date, contract type, external number of contract etc., availible for business uses.
  • We know that contract attributes are maintained in table J_3RFCNT. We try to find standard CDS views based on this table. In ABAP Dictionary in Where-Used-List we find I_RU_Contract CDS view:

  • Now we are almost happy, but unfortunatly in this CDS view does not contain all needed attributes, e.i. J_3RFCCNT-CNTDATE Contract Date.
  • But we know that we could extend cds view with need field even more so need fields are in the same table. We write extention like this:

  • Now we have all needed fields in extended standart CDS view. We are experienced developers and know that we should reuse code as much as possible and don’t create entities is standard one exist. We respect rules…
  • We add new assosiation to our CUBE ABAP CDS view and get error in activation that annotation ObjectModel.representativeKey is missing.
  • We respect rules and are not going to modify standard CDS view I_RU_Contract. We try to use CDS view with type Metadata Extension to add additional annotation, but in documentation with accordance to our version of system we find that we can’t add this annotation (see ABAP Release 751 here) because:
  • So that’s it…We tried all posible variants and could create new ABAP CDS view:

♦ Summary

  • Before using standard CDS views check and review annotations even in before “define view” part
  • In case of dimention CDS view, in should be annotated appropriately and have annotation about representative key
  • Check possibility to use metadata extension of CDS view in advance before using it
  • Check current list of possible metadata extension annotations
  • If you are planning to use some features of ABAP CDS view, but you system version is not modern, check ABAP Feature Matrix, may be some features are not availible yet in you current system version.

 

Thank you for attention!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply