Skip to Content
Technical Articles
Author's profile photo ashok nannuri

Identifying CDS views based on fields in S/4 HANA

In order to use a CDS view we need to know which the fields available are. If we know the CDS View you need to go to the SQL View to know the fields.

 

In SE11 we can’t directly see the CDS view, above image is an example for that.

In-order to get CDS views based on fields, this tool will help us to find CDS view based on fields.

 

We will be creating join conditions between 2 tables to achieve it.

  • DDLDEPENDENCY – This table stores all the information about CDS views and their SQL views.

 

  • DD03L – This has all the table fields stored in it.

 

I will be creating Quick view using SQVI transaction.

 

Enter Quick view name and click on create.

Enter Title.

Select datasource as Table join on Basis mode.

 

Insert 2 table names and have join conditions as shown above and click back.

 

Please add following fields

 

Below fields are used for selection criteria. Click on save, once completed.

 

Execute the tool which we just built.

I have given a field from FI which is AKONT (Reconciliation field)

 

Below are the CDS views based on AKONT field, choose as per your requirement and use accordingly.

Assigned Tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vikash C Agrawal
      Vikash C Agrawal

      Excellent utility..thanks for sharing

      Author's profile photo Andrea Clöß
      Andrea Clöß

      With code completition you get all fields of the structure!

      Another easy way is to use Eclipse with ADT to view and edit CDS.

      And if you haven't Eclipse try report RUTDDLSSHOW or RUTDDLSSHOW2.

      Author's profile photo Christian Winheller
      Christian Winheller

      It's more a "Where used thing". If you know a field and want to see in which CDS you can find it.

      Author's profile photo Uladzislau Pralat
      Uladzislau Pralat

      Hi Ashok,

      still trx. SQVI? In S/4 HANA? What about creating CDS View?

      Regards, Uladzislau

      Author's profile photo Joachim Rees
      Joachim Rees

      Yeah, that would also be a nice possibility!

      Feel encouraged to share such a solution (a CDS view combining  DDLDEPENDENCY + DD03L)  with us!

      best
      Joachim

      Author's profile photo Joachim Rees
      Joachim Rees

      Hi ashok nannuri ,

      Thanks for sharing!
      At first I didn't know what you where going at.
      (With your first screenshot showing SE11 with ACMTST_DDL_BP2 , my immediate thought (like Andrea Clöß already mentioned ) was: "well, we can go to AdT/Eclipse, alt+shift+a to open that object, and there we see the fields right there in the source)

      But then I read the rest of your post.
      Now I understand your idea to combine DDLDEPENDENCY + DD03L in a quick view.
      And how you use it to answer questions like in your example given: what CDS-views do contain fields based on data element AKONT.

      Very nice, I like it!
      Best
      Joachim

      Author's profile photo Shanthi Bhaskar
      Shanthi Bhaskar

      Nice blog, I wrote a blog to get the info through AMDP and table function

       

      https://blogs.sap.com/2019/04/17/s4-hana-cds-view-field-information/

      Author's profile photo Christian Winheller
      Christian Winheller

      Thanks, good hint. I was so deep into thinking only of CDS and Eclipse that I missed that puzzle piece.

      So just to complete the idea: This way you could also go by other DD0* tables. You could see which field using certain domains or having certain strings in description texts (etc,...) are used in CDS views.

      Thank you!

      Author's profile photo Christian Winheller
      Christian Winheller

      Based on Ashoks suggestion, here is a CDS snippet for your copy paste convenience.

      It is extended by Domname (which I usually heavily rely on) and the checktable. Searching for any of these gives you varying results.

      @AbapCatalog.sqlViewName: 'ZIBCVIEWFIND'
      @AbapCatalog.compiler.compareFilter: true
      @AbapCatalog.preserveKey: true
      @AccessControl.authorizationCheck: #CHECK
      @EndUserText.label: 'Find CDS Views based on used fields'
      define view ZI_BC_ViewFinder as 
          select from ddldependency
              left outer join dd03l   on  ddldependency.objectname = dd03l.tabname 
                                      and ddldependency.state = dd03l.as4local                             
      {
          --- CDS
          ddldependency.ddlname,
          ddldependency.objectname,
          ddldependency.objecttype,
          --- CDS SQLView
          dd03l.tabname,
          --- CDS SQLView Fields
          dd03l.fieldname,
          dd03l.keyflag,
          dd03l.mandatory,
          --- CDS SQLView Field Generalized
          dd03l.rollname,
          dd03l.domname,
          checktable
      }

      Please note searching for domain enhances the result list compared to only checking for fieldnames:

       

      Example usage:

      I want to know which (standard) CDS View represents the table MVKE.

      I pick one or more representativ fields from that table. Here I go with only MVKE-KONDM, especially its associated domain "KONDM".

      Checking the Views I could narrow it down to I_ProductSalesDelivery.

       

      I would love to have an easy way to search the CDS code, which is stored in DDDDLSRC-SOURCE but I think there is something to it. If I have the time, I'll try to build something to do a full text search over it or is this available already and I've just missed it?