CDS View for Functional
2023-10-4 04:18:55 Author: blogs.sap.com(查看原文) 阅读量:5 收藏

Introduction

Hello everyone!

When transitioning to the SAP S4 HANA Cloud system, functional consultants encounter a significant change: we can no longer access tables directly. This shift can feel like losing a vital tool in our toolkit. However, fear not! In this blog, I’ll show you the alternative that SAP has provided in the SAP S4 HANA Cloud system for accessing data similarly to tables. I’ll explain how to use it and how to find the views with the required fields.

Understanding SAP S4 HANA Cloud’s Virtual Data Model (VDM)

In SAP S4 HANA Cloud, the Virtual Data Model (VDM) forms the foundation for data access. It aims to expose all business data in a way that’s easy to understand and consume. VDM is called a virtual model because it abstracts data from database tables, providing access to the corresponding data at runtime. The VDM is implemented using Core Data Services (CDS).

VDS%20Model

Types of CDS Views

CDS views in SAP S4 HANA Cloud come in various types, including:

  1. Basic Interface Views: These directly access database tables and are used to make table fields more understandable by renaming them with business-friendly names.
  2. Composite Interface Views: Built on basic interface views, these can link to different composite views or combine multiple basic interface views, creating new semantic views for analyzing and using data. They don’t access the database directly but rely on basic views.
  3. Restricted Basic and Composite Views: Similar to basic and composite views, but reserved for SAP’s use and not accessible to customers or partners.
  4. Consumption Views: These sit at the top layer of VDM CDS views and access the database indirectly through the reuse layers. They are designed for specific transactional or analytical applications and are used for creating analytical queries.

Naming Conventions in VDM CDS Views

CDS view names consist of up to four elements:

  • Prefix (Mandatory): Indicates the view type, such as “C_” for consumption views or “I_” for composite and basic views.
  • Semantic Name (Mandatory): Describes what the CDS view is about based on the business process.
  • Suffix (Optional): Specifies the purpose of the CDS, such as “Query,” “Cube,” or “TP” (for Transactional data processing).
  • Version Number (Optional): Used when there are multiple versions of the CDS view.

Example:

C_GoodsMovementQuery_2

CDS View Name element Mandatory or Optional Example Reason
Prefix Mandatory C_ Indicates the view type
Semantic name Mandatory Goodsmovement Based on the business process, Indicates what the CDS View is about
Suffix Optional Query Indicates the purpose of the CDS such as Query, transactional etc
version number Optional _2 If there are more than one version, the versions are noted here

Finding CDS Views in SAP S4 HANA Cloud

You can easily find CDS views using the Fiori app “View Browser.” It allows you to search for available CDS views in your system, including their release status.

We can use only the CDS View with status as “Released” to fetch the data in the ABAP program and only those can be used in the Custom analytical queries.

You can search CDS views in two ways:

  1. By using business context (e.g., purchase order, sales order)Business%20context%20search
  2. By using required table names or column names in the alternative search. For accessing the alternative search click the “Alternative Search” button on the view browser app.Alternative%20search

Additionally, you can search for CDS views on the SAP Help Portal using the below link:

https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/5418de55938d1d22e10000000a44147b.html

Viewing Data in SAP S4 HANA Cloud

In SAP S4 HANA Cloud, accessing database tables directly is no longer an option. Instead, you must use CDS views.

For example, to view all sales orders, you should use the “View Browser Fiori app” to find the relevant CDS view (e.g., “I_SALESORDER”). Then, use the “Customer Data Browser” Fiori app to access the data, similar to SE16 for tables.

In the customer Data Browser select the required CDS view to view the data, if needed we can enter selection criteria.

Records%20in%20CDS%20View

You can export data or create filters as needed, providing flexibility in working with your data.

What if CDS Views Aren’t Available?

While most database tables can be accessed through released CDS views, not every business objects may be available. SAP regularly releases new CDS views with quarterly updates to cover all business objects. If a CDS view isn’t available for a specific business object, you can still access the data through tables in the “Customer Data Browser.”

Tables

Please note that SAP removes tables related to a business object if a CDS view is released for that object.

Conclusion

In this blog, we’ve explored the world of CDS views in SAP S4 HANA Cloud. As a functional consultant, understanding and effectively using these views will be essential for your work in the system. Embrace this shift in data access, and you’ll unlock the full potential of SAP S4 HANA Cloud for your business processes.

Thank you for reading, and feel free to reach out if you have any questions or need further guidance. Happy data exploring!


文章来源: https://blogs.sap.com/2023/10/03/cds-view-for-functional/
如有侵权请联系:admin#unsafe.sh