cds2alv – Generate ALV list reports for CDS views
Welcome to this blog post introducing cds2alv.
cds2alv is an open source project offering a framework to generate ALV list reports for CDS Consumption Views similar to Fiori Elements. It was originally created as an environment to allow developers to learn CDS and SAP Fiori independently.
It has since evolved into a tool for quickly creating monitoring transactions based on CDS and serves as an intermediate step in the transition from ALV list reports using ABAP SQL to SAP Fiori apps using CDS and OData.
- Easy to learn: Report generation requires no further knowledge apart from CDS
- Consistent User Experience: The generated reports share a common Look and Feel
- Interactive: The generated reports support Intent-Based Navigation similar to SAP Fiori and BOPF actions
- Future Ready: By Design, CDS views created to be used with this framework, can later be used as a basis for SAP Fiori Elements apps offering the same or similar functionality
- Extensible: Reports can be enhanced by additional features that can be switched on or off for each view individually
The project is to be installed using abapGit. For further information please refer to the installation guide. It is maintained on release R/3 NetWeaver AS ABAP 7.50, and it runs on S/4HANA On-Premise with minor adjustments.
The framework came to be as the result of several efforts to streamline and automate various repetitive tasks during the development process of list reports. The desire for this first arose in a project in late 2017. Over the course of this project several reports had the be developed, all of which featured almost the exact same selection screen, selection logic, ALV layout and event handling.
In the end this led to the development of a custom ALV wrapper class with a simplified interface to allow efficient and uniform integration of ALV into custom reports and classes. The other three pain points, uniform treatment of selection screens, selection logic and event handling, remained unsolved for the time being.
The next step towards a solution was the discovery of CDS and the Virtual Data Model (VDM). The Interface Views served as an elegant solution to the problem of reusable selection logic.
Finally, the problem of finding a generic solution for selection screens and event handling could be solved using CDS annotations and Intent-Based Navigation, borrowing the respective solutions from SAP Fiori elements.
The first version of cds2alv was finished in late 2021, but that version was still rather unpolished. Over the course of the last two years it was revised and refined to its present state.
If you want to learn more about the tool‘s history and its underlying ideas, please check out my talk from the ABAPconf 2021 (in German language): ABAPConf 2021
Reports are generated and executed via transaction code ZCDS_ALV_START. This transaction code works similarly to the classical SE16 transaction. Reports for specific CDS views can be made available individually by means of a parameter transaction.
The repository contains a subfolder with a simple demo showcasing the basic features. Alternatively, the framework can also provide a demonstration by itself by using it to generate list reports for the framework’s own CDS views.
Using cd2alv, developing an ALV list report boils down to creating and annotating the CDS Consumption View and possibly defining a parameter transaction for individual use. An overview of supported annotations is given as part of the documentation.
There are several possible ways in which cds2alv can handle Intent-Based navigation:
- Individual implementation: Handling for a specific CDS view can be implemented using an exit class.
- Standard implementation: Three options for reusable Handling are supported:
- Function Module: The value of a cell with in the ALV grid is passed as an importing parameter to a function module.
- Business Object Method: The value of a cell is used as key value to instantiate a BOR object. Subsequently a method of this object is called.
- Transaction call: The value of a cell is stored in a SET-/GET-Parameter, follow by calling a transaction.
We plan to add support for static methods and instance methods of classes with public parameter-less constructors in the near future. The standard implementations are defined using the framework’s own view cluster ZVC_CDS_ALV_FW.
The reports generated by cds2alv can be extended by predefined plug-in extensions. These extensions can enhance several steps of the program flow as described in the documentation. We also plan to offer a selection of ready made extensions as part of a separate repository in the near future.