Background documentationWorking with the ALV Grid Control Locate this document in the navigation structure

 

Basics

The following graphic illustrates the steps required to display a list with the ALV Grid Control:

This graphic is explained in the accompanying text.

As a minimum, you must provide the following two types of information for displaying the data:

  • An internal table with the data to be displayed, called the output table

  • A description of the structure of this data that is declared to the ALV Grid Control through the field catalog or through the corresponding structure of the Data Dictionary.

Generally, the output table contains data that you previously selected from database tables.

Caution Caution

The reference to the output table that you pass to the ALV Grid Control should be valid as long as the ALV Grid Control operates on it. Besides defining this reference as a global table, you can also hold the reference in an ABAP Objects instance using a public attribute.

End of the caution.

The field catalogis a table that contains information on the fields to be displayed. For example, the ALV uses this table to identify the type of a field. You can also use special fields of this catalog to determine the number format and column properties of the list to be output.

Working With Controls

As a result of using ABAP Objects for Release 4.6A, SAP made controls programming consistent for the following procedures:

  • Creating a control and integrating it into the screen

  • Passing methods from the backend to the frontend

  • Handling events triggered by the control at the frontend

  • Destroying the control (Lifetime Management)

For Basis controls (such as the textedit control, the HTML viewer control or the picture control), the same programming model is applicable to the above procedures.

This programming model is also valid for the ALV Grid Control, with some restrictions, however, in the area of event handling (see next section). To make yourself familiar with this general model, see Creating a Control (and all cross-references). Also, you are absolutely recommended to read the next section on the special aspects of the ALV Grid Control.

Special Event Handling Aspects of the ALV Grid Control

The ALV Grid Control uses the grid control to display the output table. So we can say that the ALV Grid Control is a wrapper that uses the wrapper of a Basis control. As the 'outer layer', this wrapper spares the developer from having to register the events on the frontend in order to simplify event handling. The ALV Grid Control differs from Basis controls in the following respects:

  • All events are registered as system events when the control is instantiated.

    Note Note

    If you want to register all events as application events, you must use parameter I_APPL_EVENTS. Then call method CL_GUI_CFW=>DISPATCH in PAI.

    End of the note.
  • Events DELAYED_CALLBACK or DELAYED_CHANGED_SEL_CALLBACK are registered using method register_delayed_event.

  • For Drag & Drop With the ALV Grid Control no DISPATCH call is required.