Copyright 2024 - BV TallVision IT

ALV or Abap List Viewer is the only way to do your reporting. Never mind the WRITE statement, forget all about making a "classic list" report interactive, just move towards modern reporting: the ALV list. It looks like an Excel spreadsheet, it allows the end user to sort, filter, customize column settings and even make these settings default specifically for the end user. If you are still thinking of composing a report with WRITE - think again, as ALV is a much better and faster alternative.

It transforms the data from a report into a setup with cells of data, which is used quite a lot in standard SAP applications as well. A typical example is transaction SM31, which is in effect an ALV grid control with editing capabilities.

A suite of function modules that can be called effectively build and process the ALV-ed report output whichs allows a variety of functions to be included. Sorting, download, swapping around fields on the display and recording the layout settings are only a few of the possibilities. But don't start with the function module stuff when you're starting with ALV's. Skip function modules and step onto the Object Oriented train right away.

Add functionality to the menu of your ALV list and respond to it, or remove functionality you don't need/want.

Show or hide menu options

You have control over the functions that are available in ALV lists. The will apply logic to determine whether functions should be available, such as the ∑-button (only available when at least 1 column with numeric values is available). If you want to deny your user the sort functions, because your output is very time-relevant, follow this example (where go_salv is an instance of class CL_SALV_TABLE): 

How to make an ALV report respond to a hotspot clicks ? A brief demo on hotspot clicks, double clicks, ALV selections and handling menu actions. For key fields to other documents you can make the report more interactive with drill-down functionality to more detailed information. To respond to a double click (or single click / otspot click) you'll need to set up a method which will be called responding to the actual double click. To do this a local class is added to the program by filling in it's definition and its implementation. 

Quick reference to the available colors in ALV, where the first number is INT (Intensified: 0 or 1), the second INV (Inverse 0 or 1) and the third number is COL (the color number, 0 to 7).

ALV is great stuff. Make it even greater with these handy hints and tips on ALV. Use as selling point if needed. 

You have an ALV report up and running, for a small selection of "liquid data", information that changes frequently. This article shows you how to add refresh action in the form of a button to your report, following a step by step plan. 

Can an ALV report be refreshed automatically every so-many seconds ? Yes it can and this article explains how. If you have an ALV report which already has refresh functionality, simply follow the step-plan to auto refresh it. 

After delivering yet another smashing ALV report with the nice-looking "Zebra stripes" (or "Striped pattern"), my end user pointed out a disadvantage. One that will make me avoid Zebra settings, for all future ALV reports.. 

An ALV report can be exported to XLS, which is a great way "out of" SAP, much embraced by many users. Especially where monthly figures are concerned, it is good to be able to fall back on XLS formats. But what happens if the ALV report has too many columns ? Have you noticed leading zero's go missing ?

When using ALV reporting, you can allow your end user to change around columns, set the colums to sort on and even define aggregate (totalling) settings. The user can also store these settings as a default for the user, or even as default to all users (who don't have a user setting). These column settings are called Layouts, and they should be made available before they can be used: 

ALV grid as editor - changing fields (Abap Objects). This will allow you to turn your report into an editor with the same look and feel as SM31

When an ALV grid is used, it's also possible to switch to "edit mode" which will perform some drastic measures to the ALV: If a single field (e.g.) is made available for editing, the following changes are done to the ALV:

Drag & drop can be implemented with ALV or hierarchies as well, here's how... (Abap Objects). There are events for dragging & dropping whatever you would like to drag around. The main ingredients for Drag & drop:

Dragdrop events class definition

In case you are working with an ALV, class cl_gui_alv_grid- the events which are related to the drag & drop actions need to be responded to. This is done by implementing a class in which the respective events are handled, like this: