I was thinking about writing a book about ALV Grid for a long time, but there was always an excuse to not to do it. One of the biggest was that SAP is now strongly advertising Fiori and UI5 as the next generation of UI in SAP world and I was thinking about when SAP will kill old ALVs. This so far didn’t happened and as there are dozens of ABAP developers who still creates reports and transactions inside the ERP systems using the good old ALV Grid, I’ve decided to finally do it. Personally I don’t see how expert users could easily switch to Fiori or UI5 apps, especially that I haven’t seen so far an editable grid or table there. But maybe I’m just blind. 

Personally I’d prefer that SAP would create new controls that would look like the one you can get in every Windows or iOS applications, which you can easily add via drag & drop in screen editor. But probably this will not happen soon, maybe even never. That’s why it’s really important to get an idea what you can do with the controls that are already available in SAP. In this tutorial I will try to show you what you can do with ALV Grid. If possible I will give you an example for each functionality, so you could really understand it easily. It will not be a story, it will be a journey through the good old ABAP days. It will not be easy to read, as this will be in most parts a technical description of possibilities that ALV Grid gives you, but I hope it will help you in your daily job. 

From all available grids as the one to describe I’ve selected CL_GUI_ALV_GRID, which was, or maybe still is, called by many persons ALV OO. I’m doing this of course on purpose, while this class stays behind all other four ways of displaying ALV Grid described here, although in some of the cases it’s not that easy to see, as SAP made some effort to hide it from us.

CL_GUI_ALV_GRID class cannot be used to display data without some effort, that’s why many of the beginners starts with the REUSE_ALV_GRID_DISPLAY function module or CL_SALV_TABLE class in their programs. This is of course OK for the start but later on it happens very often that our customers (internal or external) want to have some additional functionalities of the grid and due to restrictions of REUSE_ALV_GRID_DISPLAY and CL_SALV_TABLE we have to rebuild the program to use CL_GUI_ALV_GRID. With time it became a habit to use directly the base class, just in any case, so it’s easier to extend the application in the future, but as always the choice is yours.

The code of all examples will be available to download with abapGit on https://github.com/fidley/ALVGridInNutshell

  1.  Basic Information

  2.  Field catalog

  3.  Layout

  4.  Events

  5.  Drag & Drop

  6.  Aggregation

  7.  Sorting

  8.  User-commands

  9.  Toolbar

  10.  Built-in functions

  11.  Important methods

  12.  Tricks