cds2alv – Generate ALV list reports for CDS views
2023-11-21 07:27:44 Author: blogs.sap.com(查看原文) 阅读量:9 收藏

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.

The project is available on GitHub and featured on dotabap.

  • 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.

Initial%20Screen%20of%20Transaction%20ZCDS_ALV_START

Initial Screen of Transaction ZCDS_ALV_START

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:

  1. Individual implementation: Handling for a specific CDS view can be implemented using an exit class.
  2. Standard implementation: Three options for reusable Handling are supported:
    1. Function Module: The value of a cell with in the ALV grid is passed as an importing parameter to a function module.
    2. 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.
    3. 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.

Definition%20of%20Intent-Based%20Navigation%20in%20View%20Cluster%20ZVC_CDS_ALV_FW

Definition of Intent-Based Navigation in 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.


文章来源: https://blogs.sap.com/2023/11/20/cds2alv-generate-alv-list-reports-for-cds-views/
如有侵权请联系:admin#unsafe.sh