The ABAP List Viewer (ALV) is a set of application programming interfaces (APIs; function modules or classes) for displaying data in a tabular or hierarchical format and built-in options for visual presentation and event processing.
ALV is originally short for ABAP List Viewer, but the current term found in SAP documentation is SAP List Viewer. This is of little importance, though: in everyday practice, it’s simply referred to as ALV, not by any longer name.
To users, ALV offers a friendly interface with a toolbar that allows each user to adjust the presented layout to their preferences and sort or filter data easily. Many standard SAP reports use ALV and it has become a popular tool when building custom ABAP reports due to its flexibility, ease of implementation, and variety of features.
ABAP List
The first tool for data output in tabular format was ABAP List (see figure below). Such output was generated by using the WRITE command to display one line of data on the screen. To present the data in a grid format, the fields needed to be placed at specific, static positions on the screen while processing data in a loop or a cycle.
This type of presentation, traditional in mainframe-based systems for the last century, was inconvenient for both developers and users. Developers had to write all the code manually to output each field, as well as the column headers and totals or subtotals. And users were offered only a rigid report structure that they couldn’t modify without requesting a change in the program. Making changes in such reports was also inconvenient and time-consuming.
ALV List
The first implementation of the ALV framework was the Classic SAP List Viewer, usually referred to as ALV List. As you can see in the next figure below, this was a major improvement over the plain ABAP List functionality: the columns are nicely aligned and the toolbar offers additional functionality, such as sorting, filtering, and subtotals. More importantly, users could choose which columns they wanted to view and in which order. Their preferences could be saved in a layout to be applied next time they ran the report.
For developers, ALV offered a unified set of tools for data presentation, with no more calculating the screen position of each column and writing all the code manually. When using the ALV framework, developers only needed to be concerned with preparing business data; the ALV framework took care of the presentation.
Classic SAP List Viewer supported single-level lists, like the one shown below, and multilevel or sequential lists.
ALV Grid
The next step in the ALV evolution was ALV Grid: an Excel-like tabular format that is used to this day, although the specific APIs have evolved further. The first implementations of ALV Grid used SAP function modules with names starting with REUSE_ALV. The below figure shows an example of such a report in the BALVSD02_GRID SAP demo program.
First Object-Oriented ALV Framework
The next iteration of the ALV framework was implemented using classes with names starting with CL_GUI_ALV. This aligned with the strategic introduction of object-oriented ABAP programming in SAP ERP version 4.6C. Visually the class-based implementation produced results very similar to the function module, but one notable difference was that it allowed an ALV object to be bound to a custom container on a screen. This made it possible to present not just one full-screen report but multiple ALV containers on the same screen.
SALV Framework
The current implementation of the ALV framework is called SALV and it’s been available at least since SAP NetWeaver 7.0. This framework is provided by classes with names starting with CL_SALV and supports the ALV table (first figure below), ALV tree (second figure), and hierarchical-sequential list (third figure) formats.
Grid versus Table: In previous ALV implementations, the Excel-like presentation format was called a grid, but in the SALV framework the same format is called a table. These are synonymous and you might hear both used interchangeably by developers, regardless of which specific framework they refer to.
9
Although the previous ALV framework was already object-oriented, SALV offers a more modern implementation, using ABAP features and syntax that were not available in older versions.
ALV with IDA
A more recent variety of the SALV framework, called SAP List Viewer with Integrated Data Access (ALV with IDA), also takes advantage of in-memory database functionality.
ALV Demo Programs
Many demo programs have been made available by SAP to illustrate the possibilities of different ALV framework implementations. This table shows the demo program locations for each variety:
Missing Data in ALV Demo Programs: Some of the ALV demo programs use special tables instead of the SAP flight training model. If you find that a demo program doesn’t show any data, execute Report BCALV_GENERATE_ALV_T_T2 to fill in the ALV demo tables.
Conclusion
You’ve now learned about the ALV technology and various frameworks that exist for it in SAP ERP systems. We’ve discussed the function-based and old class-based ALV frameworks, as well as modern implementations called SALV and ALV with IDA.
Editor’s note: This post has been adapted from a section of the book ABAP: An Introduction by Brian O’Neill and Jelena Perfiljeva.
Comments