Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

alv with object oriented programming

Former Member
0 Kudos

any advatange of alv with object oriented programming


Active Contributor
0 Kudos


Apart from the advantages in displaying the grid, the found the following advantages with Grid Control.

1. The instance of the grid can be cleared during the session, this is not possible with Function module ALV. When ALV function module is called, the function group gets initialized. All the variables in the funciton group are instantiatd and occupy memory. this memory cannot be cleared in the session. Thus ALV function modules occupy more memory. Thus make them work slower than ALV grid control.

2. Handling of Events at runtime becomes more simpler in ALV grid control.

3. A page can have n number of ALV grid controls.

4. The runtime environment can be controlled efficiently in ALV grid control.

this is another reply

Hi. The use of the grid control vs the function module based ALV is really based on personal preference, I think. Although I think that many should learn the control based ALV as it will help to learn ABAP OO. The control is used when you have a dynpro or container in which the ALV is to reside in. You use the FM, when you want a full screen alv with the buttons on the application toolbar. If you look under the hood, of the FM, you will see that the control based ALV is implemented underneath.

Also, really you should look in the ALV object model which was introduced in Netweaver 2004. It provides one unified tool for the 2d table display, so you can use the one tool to provide the "Full screen" display which is provided by the FM ALV and the control based ALV.

You will see arguements that you shouldn't use the FM and always use the control based ALV. I'm not sure that it is 100% true either way. But I do think that you should learn and start using the ALV Object Model, if you are on a Netweaver release.

another one

For a better look and feel ALV grid is best and you have all the options for downloading , summing etc on the toolbar itself.

But care should be taken not to use ALV report when the report is executed in background. ALV will give an error.

In this case, check the field SY-BATCH and use simple classical reporting if execute background and ALV if execute foreground.



Former Member
0 Kudos


1. For all practical purposes, they are the same.

2. Some differences:

a) from abap coding point of view,

alv list is done with Function modules,

alv gris can also be done with FM,

but can also be done using OO concepts.

b) Alv grid (using oo concept) requires

designing the screen layout .

Hence, in one screen, we can show more

then one alv grid

(we cannot show more than

one alv list on one screen)

c) ALV grid uses ActiveX controls

present on the Presentation Server.

Hence, it consumes More Memory

on the presentation server.

d) ALV LIST is Display Only.


ALV Grid Can Be made EDITABLE for entry purpose.

e) In alv grid, these options are possible,

but not in alv list.

without horizontal lines

without vertical lines

without cell merging during sorts

display total lines above the entries .

ALV LIST Can be coded using only FMs

ALV GRID Can be coded using FMs and object oriented concepts

ALV LIST Can be displayed hieraicharlly

ALV GRID cannot be displayed hierarichally

“The ALV Grid control is a flexible tool for displaying lists. The tool provides common list operations as generic functions and can be enhanced by self-defined options.”

The ALV Grid control is used to build non-hierarchical, interactive, and modern-design lists. As a control, it is a component that is installed on the local PC.

The ALV Grid control provides typical list functions as sorting, filtering, summing, etc.,while also gives the opportunity to develop user functions where needed. It presents numerous interfaces like Excel Inplace and Crystal Reports.

The wrapper class implemented to encapsulate ALV Grid functionality is “CL_GUI_ALV_GRID”. There is another way to display lists with ALV utilizing “REUSE_ALV...” functions. However, that way is not comprised in this tutorial.

B. Building Blocks

While preparing a list to be displayed via an ALV grid control, we have some basic components to prepare. These are;

i. List data: Obviously, this is the data in an internal table to be listed. Standard ALV functions except sorting makes just read access to the list data. However, sorting changes state of the internal table. The internal table holding list data may be of any flat type. Deep types are only allowed when set for some functionalities of ALV Grid.

ii. Field Catalog: We use another internal table to define specifications on how the fields of our list will be displayed. This internal table is called the

“field catalog”. The field catalog must comprise some technical and additional information about display options for each column to be displayed. There are three procedures to generate the field catalog as “Automatic generation”, “Semi-automatic generation”, and “Manual generation”. The internal table for the field catalog must be referenced to the dictionary type “LVC_T_FCAT”.

iii. Layout Structure: We fill a structure to specify general layout options for the grid. With this structure we can set general display options, grid customizing, totals options, color adjustments etc... The layout structure must be of type “LVC_S_LAYO”.

iv. Event Handler: We should define and implement an event handler class if we want to handle events triggered by the ALV Grid instance. After creating ALV Grid instance, we must register an instance of this event handler class to handle ALV Grid events.

v. Additional Data: To trigger some additional features of ALV Grid we can have some additional data to pass as parameters. For example, initial sorting criteria, buttons to be deactivated, etc..

0 Kudos

My personal experience: If you want to implement "right click" options (contextual menu) on your ALV, you will have to do it with object oriented programming.

Former Member
0 Kudos

A DISADVANTAGE of the OO ALV as against the classical one is we cannot schedule a program with an OO output in background, since the program tries to intialize the container for the ALV and it dumps.

Just FYI.