Understanding ABAP List Viewer 1

The common features of report are column alignment, sorting, filtering, subtotals, totals etc.  To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.

Using ALV, We can have three types of reports:

1. Simple Report

2. Block  Report

3. Hierarchical Sequential Report

There are some function modules which will enable to produce the above reports without much effort.

All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.


The important function modules are 

a. Reuse_alv_list_display

b. Reuse_alv_fieldcatalog_merge

c. Reuse_alv_events_get

d. Reuse_alv_commentary_write

e. Reuse_alv_grid_display

A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.

The important parameters are :

I. Export :

i.   I_callback_program       : report id

ii.  I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status

iii. I_callback_user_command  : routine where the function codes are handled

iv.  I_structure name         : name of the dictionary table 

v.   Is_layout                :  structure to set the layout of the report

vi.  It_fieldcat              : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module  REUSE_ALV_FIELDCATALOG_MERGE

vii. It_events                : internal table with a list of all possible events of ALV and their corresponding form names.

II. Tables :

i. t_outtab  : internal table with the data to be output

B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.

The Important Parameters are :

I. Export :

i.   I_program_name     : report id

ii.  I_internal_tabname : the internal output table

iii. I_inclname         : include or the report name where all the dynamic forms are handled.

II  Changing

ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.

C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type                         
Parameters : 

I. Import :

Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME').  For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can  be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.                        

II. Export :

I_List_type :                                                

0 = simple list                        REUSE_ALV_LIST_DISPLAY         

1 = hierarchcal-sequential list        REUSE_ALV_HIERSEQ_LIST_DISPLAY 

2 = simple block list                  REUSE_ALV_BLOCK_LIST_APPEND    

3 = hierarchical-sequential block list REUSE_ALV_BLOCK_LIST_HS_APPEND

D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.

Parameters : 

I. it_list_commentary : internal table with the headings  of the type slis_t_listheader.

This internal table has three fields :

Typ  : H header, S selection , A - action

Key  : only when typ is S.

Info :  the text to be printed

E. REUSE_ALV_GRID_DISPLAY :  A new function in 4.6 version, to display the results in grid rather than as a preview.

Parameters  :  same as reuse_alv_list_display

This is an example for simple list.

Read Also
Simple Program that Create Internal Table Dynamically

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.