Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
AlwinPut
Active Participant
4-1-2024: Version 2 is now released.
See blog post: https://blogs.sap.com/2024/01/04/abap-search-cds-view-tool-version-2-also-finds-rap-objects/

14-7-2023: New functionality added for filtering on fields with field names, data elements and domain names. Also searching on fields without the "hierarchically search" is possible. See scenario "Filter on field name, data element name or domain name" to see how it works.

Searching for the right CDS view can be a time consuming task. A DB table / DDic View or CDS View can have hierarchically more than 8000 related views. DB table MARA has for example 8201 related views in S/4HANA 2022. Searching is also error prone, because searching based on naming does not always lead to the right view.

A good way to search is to find all related CDS views based on DB table, DDic view or CDS view which are directly and indirectly related. This can go up to 15 or more levels deep. So doing this manually by executing where-used list is not doable. Therefor I created the “ABAP Search CDS View Tool” which also can filter the found views.

The following scenarios explain how the tool works.

Scenario: Find all related views of MARC



  • Start program ZSCV_SEARCH_CDS_VIEWS

  • Fill "DDic table / view": MARC


  • Press F8

  • The status bar will mention how many Views are found.


 

 

  • The results will show 3 types of Views

    • DDic Views

    • DDic CDS Views

      See that the DDL Source Name and DDic View Name is filled.

    • Entity CDS Views
      See that the DDic View Name is not filled.




Scenario: Filter for ABAP allowed internal CDS views


Now I only want to see all CDS views which are allowed to be used in ABAP.

  • Go back to selection screen

  • Push the button "Internal API (C1)". Now the field "C1 Release state" will be filled with RELEASED and field "C1 In ABAP allowed" wil be checked.

  • Push F8.
    Now 84 Views are found. Here are some views.


    • See that the DDic CDS views and Entity CDS views are found.

    • The views have all C1 RELEASED and have C1 Use in Cloud Platform selected.

    • Also other annotations are shown like Data Category, VDM View Type, Authorization check, Data Class and Contract Type.

    • See that some have Contract Type #PUBLIC_LOCAL_API.




Scenario: Filter for #BASIC views


I want to search for the basic views for table MARC.

  • Go back to selection screen and fill VDM View Type: #BASIC.

  • Press F8.
    Now 13 views are found.

  • In the description in SE11 we can see that the description of table MARC is "Plant Data for Material".
    So based on the naming the most basic CDS view for MARC is CDS View I_PRODUCTPLANTBASIC.


Scenario: Filter on Public API CDS views


Now I want to search for CDS views which are enabled and released for OData.

  • Go back to selection screen and clear the VDM View Type.

  • Push button "Public API (C2)". Now the filter for the C1 fields are cleared and field "C2 Released state" is filled.

  • Press F8
    Click on the picture to enlarge it.

    See that all these CDS views have C2 status RELEASED. And also have Contract Type #PUBLIC_REMOTE_API. Also the view names start with A_ which stands for API.


Scenario: Filter on custom views


I want to know which custom views call directly or indirectly the DB table MARC.

  • Go back to selection screen and clear the VDM View Type.

  • Push button "All statuses", to clear all status fields.

  • Fill ABAP View with Z*.

  • Press F8.

    Now DDic views (also DDic CDS views) and Entity CDS views starting with Z will be shown.


Scenario: CDS views specified by SAP


For some database tables SAP defined in table ARS_W_API_STATE the relation from the DB table to the CDS view.

  • Go back to selection screen.

  • Fill "DDic Table/View" AUFK.

  • Press button "Successor CDS view".
    See that it finds de DDic name IORDER of DDic CDS view I_ORDER.

  • Press F8 to find all Views related to the CDS view I_ORDER.


Scenario: Filter on field name, data element name or domain name


In this scenario we are going to search for a field "Minimum Lot Size" (BSTMI) in table "Plant Data for Material" (MARC).




  • Restart the program ZSCV_SEARCH_CDS_VIEWS, so that you have a clean selection screen.

  • Fill Field Name

  • Press F8.
    It will find in S/4HANA 2022 81 views.
    Those are DDic tables, DDic views, DDic CDS views and Entity CDS views with that name.
    However it won't find CDS view I_ProductPlantBasic, because the field name is MinimumLotSizeQuantity in that CDS view. So we should search for field name MinimumLotSizeQuantity or we can search for the Data Element Name or Domain Name. The Domain Name is MENG13, so it is too generic. So let's search on Data Element.

  • Clear Field Name and Fill Data Element Name with BSTMI and press F8.
    Now 158 views are found. Because many more CDS views are found.

  • Now we only want the released CDS views. Push on the selection screen the button ABAP C1 + C2.

  • Press F8.
    Now you see 15 released CDS views which have a field with data element BSTMI.

  • If you want to see only the views which are based on MARC, than set field Root Table / View MARC and press F8.
    Now 12 released CDS views are shown.

    See that for example CDS view A_PRODUCTPLANTMRPAREA is not shown now. That is because field MinimumLotSizeQuantity (BSTMI) is not retrieved from table MARC, but from table MDMA.


How does the tool work?


DDic tables and DDic views are related in table DD26S. CDS views are related to CDS views and DDic views and tables via table DDLS_RIS_INDEX. I have created some CDS views to create one UNION CDS views for both type of relations. By using a Hierarchy CDS View (ZSCV_AbapViewHier) the HANA database searches hierarchically all the related Views.

CDS views relation table DDLS_RIS_INDEX


DDic CDS Views are related to other views by DD26S and DDLS_RIS_INDEX, because they are activated as DDic View and as CDS View.

DDLS_RIS_INDEX contain however beside the FROM and JOIN also ASSOCIATION relations. This causes an explosion of relations. When I used the DDLS_RIS_INDEX also for DDic CDS Views, than I had these results:

  1. MARA: 28.935

  2. MARC: 28.400

  3. AUFK: 27.137

  4. AUFM: 13

  5. PROJ: 27.584

  6. AUSP: 26.942


The problem is that many tables have relations with for example a view related to MARA and than it also selects all MARA view related views.

For now the search works, because there are not that much Entity CDS views, but in future when SAP might decide to convert DDic CDS Views to Entity CDS Views and for sure will create more and more Entity CDS views. Than the tool should be changed that only the FROM and JOIN will be used, and not the ASSOCIATION.

Please do not use the second option yet, because it will probably result in a memory error. In the upcoming version I changed the technique to use ABAP code instead of a Hierarchy CDS View.



Download and install Open Source code


Download code from GitHub: https://github.com/alwinvandeput/zscv_search_cds_views

Use ABAP Git to install the software.

Other search options



Author: Alwin van de Put
18 Comments