You are on page 1of 34

ABAP List Viewer

(ALV) Reports
INTRODUCTION

•The common features of report are column


alignment, sorting, filtering, totals etc.
To implement these, a lot of coding and logic is
required. To avoid that we can use a concept
called ABAP List Viewer (ALV).

•ALV report has a set of tools to display the data


in a formatted manner.

•It provides set of function modules,which can


be used to enhance the reliability and
functionality of a report.
SIMPLE REPORT
ALV REPORT
FEATURES

Key functions of the ABAP List Viewer for reports are:

Creating, changing, and managing layouts

Sorting in ascending and descending order


Setting a filter

contd...

Displaying totals and subtotals


Displaying detailed information
Searching
Printing lists and print preview
Exporting data
TYPES OF REPORTS

Using ALV, we can have three types of reports:


1. Simple Report
2. Block Report
3. Hierarchical 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.
STEPS TO CREATE AN ALV REPORT...

<1> Create an internal table


<2> Data declaration
<3> Populate the internal table
<4> Initialize the ALV layout
<5> Initialize the field catalog
<6> call function 'REUSE_ALV_GRID_DISPLAY'
SIMPLE ALV REPORT

 Classical ALV Report


 Interactive ALV Report

The important function modules are:

 Reuse_alv_fieldcatalog_merge.
 Reuse_alv_list_display.
 Reuse_alv_grid_display.
 Reuse_alv_commentary_write.
BASIC SRUCTURE OF ALV REPORT…

TYPE-POOLS “- - - - ” eg. SLIS.


*---------------------------------------------------------------------*
* Declaration
*---------------------------------------------------------------------*
DATA: - - - - - - - -

*---------------------------------------------------------------------*
* Selection (Definition)
*---------------------------------------------------------------------*
SELECT - - - - - - - -
*---------------------------------------------------------------------*
* Call ABAP List Viewer (ALV)(Display)
*---------------------------------------------------------------------*

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
TYPE-GROUP  ‘ SLIS ’
SLIS is the type library for ALV.

Pre-defined data-types and constants,


Internal tables,structures.

EXAMPLE:-
SLIS_T_FIELDCAT_ALV (internal table)
SLIS_FIELDCAT_ALV (header line)

SLIS_T_LISTHEADER (internal table)


SLIS_LISTHEADER (header line)

SLIS_T_EVENT, (internal table)


SLIS_ALV_EVENT … etc.
------------------------------------------------------------------
SE11 TYPE GROUP  CREATE
REUSE_ALV_FIELDCATALOG_MERGE:

The important parameters are:

1. Export:
a. I_program_name : report id
b. I_internal_tabname : the internal output table
c. I_inclname : the report name .

2. Changing
a. ct_fieldcat : an internal table with the type
SLIS_T_FIELDCAT_ALV
which is declared in the type pool
SLIS.
Generating the Field Catalog automatically
Generating the Field Catalog manually
REUSE_ALV_LIST_DISPLAY:

This is the function module which prints the data.

The important parameters are:

1. Export:

a. I_callback_program : report id

b. I_callback_pf_status_set : routine where a user can set


his own pf status
or change the functionality
of the existing pf status.

c. I_callback_user_command : routine where the function


codes are handled.
d. I_structure name : name of the dictionary table

e. Is_Layout : structure to set the layout of the report

f. 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)

g. It_events : internal table with a list of all possible events of


ALV and their corresponding routine names.

2. Tables:

t_outtab : internal table with the data to be output


ALV LIST VIEW
REUSE_ALV_GRID_DISPLAY:

A new function to display the results in grid rather than as a


list.

Parameters : same as reuse_alv_list_display


ALV GRID VIEW
Displaying Header and Logo

REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-


of-page event to print the headings and other comments for the list.

1. 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

call function 'REUSE_ALV_COMMENTARY_WRITE'


exporting
it_list_commentary = t_header
i_logo ='TCS_LOGO'.
1. Open transaction code OAER
2. Defining class name,type and object key
3. Select Std.
Doc type
4. Upload Picture
5. Logo Selected
6. ALV Grid Display with logo and header
BLOCK REPORT

This is used to display multiple lists continuously.

The important functions used in this report are:

A. REUSE_ALV_BLOCK_LIST_INIT

B. REUSE_ALV_BLOCK_LIST_APPEND

C. REUSE_ALV_BLOCK_LIST_DISPLAY
* 'REUSE_ALV_BLOCK_LIST_INIT'

I_CALLBACK_PROGRAM = SY-REPID

* 'REUSE_ALV_BLOCK_LIST_APPEND'

It is used as many times,as many number of blocks we


want in the output list.

* 'REUSE_ALV_BLOCK_LIST_DISPLAY'.

If we want to display more than ALV LIST in the


same report when we execute our program, then
you can use this
contd....

REUSE_ALV_BLOCK_LIST_INIT

Parameters:
a. I_CALLBACK_PROGRAM- the program which
calls this function module to generate the ALV.
b. I_CALLBACK_PF_STATUS_SET-There is a
special parameter for function module
REUSE_ALV_GRID_DISPLAY, which lets you
to define a callback function for setting pf-status.
c. I_CALLBACK_USER_COMMAND
This function module is used to set the default GUI
status etc.
contd...

C. REUSE_ALV_BLOCK_LIST_DISPLAY

Parameters : All the parameters are optional.

This function module display the list with data appended by the
above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE,
REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be
used.
HIERARCHICAL REPORTS

Hierarchical sequential list output.


The function module is

A. REUSE_ALV_HIERSEQ_LIST_DISPLAY

1. Export:
a. I_CALLBACK_PROGRAM
b. I_CALLBACK_PF_STATUS_SET
c. I_CALLBACK_USER_COMMAND
d. IS_LAYOUT
HIERARCHICAL REPORTS

You might also like