SAP Fiori : ABAP developers should no longer be surprised by or limited to Core Data Service. Developers of ABAP and CDS ought to get along like water and milk. This course will help you get one step closer to learning and comprehending Core Data Services if you haven’t yet embraced CDS.
Let’s get our application’s data model started. Generally speaking, it is excellent practice to build a package and include the data model that CDS views will construct.
Make a Package
Create a package using the SE80 transaction as shown below;
Build a data model with CDS Views.
Assume for the moment that the airline industry data model exists. The airline industry will own information pertaining to carriers and flight schedules.
Now that we have this bare minimum requirement, let’s get the data model built. Three common database tables are used in this scenario:
SCARR: Airline Details.
SFLIGHT: Information about flights.
Flight schedule information for SPFLI.
We will develop three distinct basic Interface(I_) views using the three standard tables mentioned above.
How to Make CDS Views
Verify that the ADT components are correctly installed in Eclipse and connect the SAP system to the Eclipse environment.
Start generating CDS Views in the created package by performing a right-click on the Package and selecting New -> Other ABAP Repository object, as demonstrated below.
- The wizard for creating an ABAP repository object will then show up. Enter “Core” as the first character in the wizard’s filter box.
- Click Next after choosing Data Definition from the filtered list.
Click Next after entering the Name and Description for the data definition.
- Select Define View, then press the Finish button.
- The following Data Definition will be created:
Type the SQL View name to be generated in @ABAPCatalog.sqlViewName and replace the data_source_name with SCARR (in our example, this is ZAPF_SCARR in the first line). Next, add the elements that must be visible in the view.
Confirm, save, and turn on the data definition. As stated in the previous chapter, DDL SQL View will be activated after
The essential perspectives are now available. To prepare the data model for the Fiori App, let’s further transform these views into Composite views and additionally construct Consumption views (C_). The data model that we are attempting to create and offer as a Fiori app through an OData service is shown below.
Combined Views.
To create Composite views, let’s execute Association between the Basic views. Join us on the airline (ZAPF_I_AIRLINE) and flight information (ZAPF_I_FLIGHTS) associations. For the remaining views, we then create associations as shown in the Data Model diagram above. The snapshot showing the relationship between the views is shown below.
Views on Consumption
We will construct Consumption views with selection on these composite views and then association on all three Consumption views, much like Composite Views.
n the ABAP Programming Model for SAP Fiori, Core Data Services (CDS) views play a pivotal role in defining and managing data structures. CDS views are essentially SQL-based views that offer a powerful and flexible way to model data in the SAP system. They enable developers to define complex queries and data relationships in a reusable and maintainable manner. By using CDS views, you can enhance data access performance and leverage advanced features like annotations and access control.
Conclusion:
Mastering CDS views is crucial for effective SAP Fiori development. They provide a robust framework for structuring data, which is essential for creating dynamic and efficient Fiori applications. Understanding how to create and utilize CDS views will significantly streamline your development process and improve the performance of your SAP solutions.
you may be interested in this blog here:-