SAP ABAP ALV Reports
Different Types of SAP ABAP Classical and ALV Reports
As a SAP ABAP Developer, we must be know different types of SAP Classical Reports and SAP ALV Reports which are root to develop any SAP application. In the first learning stage of SAP ,we have to understand all reports types and their parameters and events and reports importance in SAP.Normally, there are several reports which are simple and interactive in which classical are old reports types and ALV are advanced reports types which are used to fetch the data from Data Base and display that data in tabular format that means columns and rows based on given input parameters conditions.
In ABAP, there are seven types of reports used in different SAP modules. But as a ABAP developer, we need to know Classical and ALV reports.
Classical
Interactive
Logical Database
ABAP query
ALV Reports (ALV stands for ABAP List Viewer)
Report Writer/Report Painter
Views
Classical Reports in SAP
Classical reports are used to display simple output which can be divided into two types
Simple –only one primary list will be displayed in output.
Interactive-one primary and one or more secondary lists can be displayed in output.
Classical Reports
Events In Classical Reports.
INTIALIZATION: This event triggers before selection screen display.
AT-SELECTION-SCREEN: This event triggers after processing user input still selection screen is in active mode.
START OF SELECTION: Start of selection screen triggers after processing selection screen.
END-OF-SELECTION : It is for Logical Database Reporting.
Interactive Reports in SAP
Interactive reports can have one basic list and 20 secondary lists (1 to 21).
Events related to Interactive Reports are:
INTIALIZATION
AT-SELECTION-SCREEN
START OF SELECTION
END-OF-SELECTION
AT LINE-SELECTION
AT USER-COMMAND
AT PF<key>
TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel : contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
ALV Reports in SAP
ALV stands for "ABAP List Viewer" that outputs data in a table form which will be displayed in rows and columns, with integrated functions to manipulate output and we sort, totals, filter, column order and hide list viewer and we can export it to Excel, Crystal report, CSV files .It is also possible to make ALV editable via ALV control.
ALV reports can be divided into 3 types
1. Simple ALV Reports
2. Blocked ALV Reports
3. Hierarchical ALV Reports
All the definitions TYPES and STRUCTURES and CONSTANTS are defined
in the TYPE-POOL 'SLIS' ,so it should be declared first.
TYPE-POOLS : 'SLIS' .
FIELDCATALOG
To prepare field catalog certain fields are essential .There are various other fields allowing for vaarious possibilities and display options.
TABNAME
FIELDNAME
REF_TABNAME
SELTECT_M
Simple ALV Reports
Simple ALV reports are used to simple List display and grid display. It can be written simple and interactive report types
REUSE_ALV_LIST_DISPLAY.
REUSE_ALV_GRID_DISPLAY
Reuse_alv_fieldcatalog_merge
Reuse_alv_list_display
Reuse_alv_events_get
Reuse_alv_grid_display
Reuse_alv_commentary_write
REUSE_ALV_FIELDCATALOG_MERGE
This function module is used to populate a field catalogue 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.
Note : Fieldcatalog can be filled manually also by filling up all the required details into the internal table
Important parameters in are:
1. Export:
I_program_name : report id
I_internal_tabname : the internal output table
I_inclname : include or the report name where all the dynamic forms are handled.
2. Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
REUSE_ALV_LIST_DISPLAY
This is the function module which prints the data.
The important parameters are:
1. Export:
I_callback_program : report id
I_bypassing_buffer : 'X'
I_buffer_active : ' '
I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status.
I_callback_user_command : routine where the function codes are handled.
I_structure name : name of the dictionary table
Is_Layout : structure to set the layout of the report
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)
It_events : internal table with a list of all possible events of ALV and their corresponding form names.
2. Tables:
a. t_outtab : internal table with the data to be output
REUSE_ALV_EVENTS_GET:
Returns table of possible events for a a list type
1. 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 the Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored
2. Export:
I_list_type: 0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchical-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
REUSE_ALV_GRID_DISPLAY
Parameters : same as reuse_alv_list_display
Note:Grid cannot handle high volumes. Functions like sort, scrolling down consumes a lot of resources , if the volume of data to be displayed is high.
REUSE_ALV_COMMENTARY_WRITE
This is used in the Top-of-page event to print the headings and other comments for the list.
Important Parameters
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
Blocked ALV Reports
Blocked ALV reports are like a simple report but this report has the features of sorting and filtering only. This report is used if you have to display more than one report on the output.
Function modules used for creating this report are:
REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_DISPLAY
REUSE_ALV_BLOCK_LIST_INIT
This function module is used to set the default gui status etc. The parameters are similar to the one used in reuse_alv_list_display or reuse_alv_grid_display
REUSE_ALV_BLOCK_LIST_APPEND
This function module adds the data to the block.
Important Parameters
1.Export :
is_layout : layout settings for block
it_fieldcat : field catalog
I_tabname : internal table name with all all possible events
2.Tables :
t_outtab : internal table with output data.
REUSE_ALV_BLOCK_LIST_DISPLAY
This function module display the list with data appended by the above function.
Parameters : All the parameters are optional.
Hierarchical ALV Reports
Hierarchical ALV reports are used for displaying data that are related. It can used when client want to display master and item details.
function module used for this is
REUSE_ALV_HIERSEQ_LIST_DISPLAY
Export:
I_CALLBACK_PROGRAM
I_CALLBACK_PF_STATUS_SET
I_CALLBACK_USER_COMMAND
IS_LAYOUT
It_fieldcat
It_events
I_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
I_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
Is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
Tables
t_outtab_header : Header table with data to be output
t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
From this post ,we have learnt the Different types of Classical reports and ALV reports and their uses and events and parameters and reports tips .This also useful for SAP ABAP interview while facing
real time interview.
Simple ALV Report Tutorial
Interactive ALV Report Tutorial
ALV Field Catalog
Events in Reports
ALV Interview Questions and Answers
Comments
Post a Comment