2006 Mar 10 7:02 AM
Hi all ,
what are ALV , how different are they from standard reports .
any suggested links or tutorials regarding this.
Regards,
sunil.
2006 Mar 10 7:12 AM
Hi sunil Deeraj
ALV's are Abap List Viewer , they are one of the type of reports, more specifically can be said as reports having more functionality.
ALV's concentrate more on bussines logic rather than thinking of formatting the layout , font , colors e.t.c
it is very simple to develop a ALV report.
step 1. extract all the data to be displayed in an internal table.
step 2. create a field catalog , which consist of the order of appearance of fields on the output.
step 3. pass the internal table to REUSE_ALV_GRID_DISPLAY
in the tables tab.
Your ALV is ready .
do reward points if found useful.
Regards,
Kishore Kumar Yerra.
attatched is the code for your reference.
data: i_qmel like qmel occurs 0.
select * from qmel into table i_qmel.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'QMEL'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_qmel
exceptions
program_error = 1
others = 2
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Hi all ,
what are ALV , how different are they from standard reports .
any suggested links or tutorials regarding this.
Regards,
sunil.
2006 Mar 10 7:07 AM
For examples go to SE38 and search for program names starting with BCALV (e.g. use F4 help on BCALV*).
IN ABAP Editor, you can also find examples at the menu path Environment -> Control Examples
Riyaz
2006 Mar 10 7:07 AM
<b>Objective</b>
ABAP List Viewer (ALV) is the latest SAP tool for reporting. It reduces the development time of reports by providing the standard interfaces (Function Modules). These standard interfaces provide GUI and formatting options for the on screen display.
A brief comparison between traditional ABAP reporting and reporting with ALV is mentioned below.
<b>Traditional ABAP Reporting</b>
50% of the time spent on finding the right tables and
table relationships (selection process)
30% of the time spent on providing fancy features sorting subtotals and overall totals.
interactive list events (AT LINE-SELECTION)
20% of the time spent on making the report output
look pretty
Column headings
Vertical lines and frames
<b>Programming with the ABAP List Viewer</b>
50% of the time spent on finding the right tables and
table relationships (selection process)
1% of the time spent on preparing field catalog and sort sequence information for the list viewer
9% of the time spent on fancy features
for interactive list events
no time spent on looks and feel
(column headings, sorting, etc.)
time savings >= 40% easily possible
Usefu link is::
http://henrikfrank.dk/abapexamples/ABAP%20objects%20and%20controls/alvgrid_control.htm
2006 Mar 10 7:07 AM
hi sunil,
Welcome To SDN.
1. developing reports using WRITE statement
is very cumbersome.
2. if the report is
to be displayed in a
excel format (ie. rows and columns)
then ALV is the best
<b>
(bcos it automatically provides other facilities
like sorting, filtering , layout selecion,
etc etc)</b>
3. To get a TASTE of it,
just copy paste in new program.
4.
It will display list of company.
On double-clicking on the alv,
it will again display the clicked company code.
Important code has been marked.
4.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
*----
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*----
CALL BACK FORM
*----
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
READ TABLE itab INDEX whatrow-tabindex.
WRITE itab-bukrs.
ENDFORM. "ITAB_user_command
regards,
amit m.
regards,
amit m.
2006 Mar 10 7:08 AM
Hi Sunil,
<b>ALV</b>
ABAP List Viewer (ALV) is the latest SAP tool for reporting. It reduces the development time of reports by providing the standard interfaces (Function Modules). These standard interfaces provide GUI and formatting options for the on screen display.
<b> Declare data areas for list viewer</b>
Data, which will be, used by the standard function modules in ALV. A sample data deceleration which has all the interface parameters definition is as mentioned below.
TYPE-POOLS: SLIS.
FOR FIELD CATALOG
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
FOR EVENTS
DATA: I_EVENTS TYPE SLIS_T_EVENT.
FOR SORTING
DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV.
FOR FIELDGROUPS
DATA: I_FIELDGROUPS_TAB TYPE SLIS_T_SP_GROUP_ALV.
FOR VARIANT
DATA: WS_X_VARIANT LIKE DISVARIANT,
WS_VARIANT LIKE DISVARIANT,
WS_SAVE TYPE C,
WS_EXIT TYPE C,
WS_REPID LIKE SY-REPID.
FOR LAYOUT
DATA: WS_LAYOUT TYPE SLIS_LAYOUT_ALV.
Declare internal table to store selected data
Internal table definition, that will store the data to be displayed on the screen. In the
example mentioned below other fields such as symbol lights and icon have been mentioned as these can be used to make reports more presentable.
Name of the internal table I_FINAL should not be changed if the standard template is used as this name is supplied to various interface parameters.
**INTERNAL TABLE FOR FINAL OUTPUT PLEASE DEFINE THE FIELDS TO BE
*OUTPUTTED HERE
DATA : BEGIN OF I_FINAL OCCURS 0 ,
SYMBOL, "IF SYMBOL TO BE DISPLAYED AFTER ACTION
ICONFLD(4), "IF ICONS TO DISPLAYED ON LIST
LIGHTS, "IF TRAFFIC LIGHTS TO BE DISPLAYED
END OF I_FINAL .
Select data into internal table
Get the required data into the internal table.
Populate display variants
ALV list provides an option to store on screen display as variants, which user can retrieve on a later date of execution. SAP provides standard interfaces for initializing and retrieving the display variant information.
Build field catalog
Field catalog defines the fields and its attributes for on screen display. Field catalog can be build using function modules provided by SAP as well as manually populating internal table I_FIELDCAT. The details of the function modules have been dealt with later in the document.
Build sort catalog.
Sort catalog contains fields on which the sorting of the list will be done. This is achieved by populating the internal table I_SORT.
Build event catalog.
ALV supports normal ABAP reporting events and handles it internally as well as externally. For external handling separate forms are created. The internal table I_EVENTS is populated with the name of the form corresponding to the event to be handled. For getting the list of all the events in ALV, SAP does provide a function module.
Build Layout
On screen display can be controlled by creating layout and passing this parameter to ALV. Display layout is build by populating the structure WS_LAYOUT in the template.
Build GUI status
ALV provides standard GUI status and handles all the user commands for the provided GUI. In case user needs some additional functionality, then he should copy the GUI status STANDARD from program SAPLSALV and make changes. This GUI status should be set in a subroutine whose name will be passed to the standard function module that calls ALV display.
Build Event Exit Table
This internal table is used to get the control from ALV to the report for specific commands. Append the function codes, which have to be handled differently into this internal table.
Build Field Groups.
For easy onscreen display selection, fields can be grouped. Populate internal table I_FIELDGROUPS_TAB with the groups and description. Assign the groups to the fields in the field catalog.
Start list viewer
Output list can be displayed in two format namely table control mode and list mode. There are standard function modules provided for both which have been dealt with later in the document. The in-house developed tool for creating ALV reports make use of the table control format.
Process call back events
In case the user events have to handled differently, it can be achieved by creating a subroutine whose name will be passed to the standard function module that calls ALV display.
<b>Function Modules</b>
1. REUSE_ALV_VARIANT_DEFAULT_GET.
This FM is used to get the default variant for the report if it has been set.
EXPORTING
I_SAVE Controls the storage mode. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
CHANGING
CS_VARIANT Gets the default variant in a structure like DISVARIANT.
2. REUSE_ALV_COMMENTARY_WRITE
This FM is used to write a comment and logo on the report header.
EXPORTING
I_LOGO Pass the name of the logo, which has been uploaded in the system.
IT_LIST_COMMENTARY The comment lines that have to be written are passed in. The structure of the parameter is like SLIS_T_LISTHEADER.
3. REUSE_ALV_EVENTS_GET
Used to get all the events available in ALV list processing.
EXPORTING
I_LIST_TYPE Type of ALV list. Allowed values are
0 simple list
1 hierarchcal-sequential list
2 simple block list
3 hierarchical-sequential block list
IMPORTING
ET_EVENTS The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). Structure of the table is type SLIS_T_EVENT.
4. REUSE_ALV_VARIANT_F4
This FM is used to get the possible values of the variants on the selection screen.
EXPORTING
IS_VARIANT Structure of this parameter is like DISVARIANT. Pass the program name through this.
I_SAVE Controls type of variant to be displayed in value help. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
IMPORTING
E_EXIT If this parameter is blank then user has selected some variant.
ES_VARIANT Selected variant is populated in this work area. Its of structure like DISVARIANT.
5. REUSE_ALV_VARIANT_EXISTENCE
Check existence of a display variant
EXPORTING
I_SAVE Type of variant. Allowed values are
A Standard and user specific variants
U User specific variants
X Standard Variants
CHANGING
CS_VARIANT Pass on variant details. The structure of this field is like DISVARIANT.
6. REUSE_ALV_FIELDCATALOG_MERGE
This FM creates field catalog from dictionary structure or internal table.
EXPORTING
I_PROGRAM_NAME Program from which the function module is called and which contains the exit routines. The program should always be a Report, Function group, Module pool or Form routine pool (not an Include).
I_INERNAL_TABNAME Name of the internal table as string.
I_STRUCTURE If the internal table is like ABAP dictionary object then pass on the structure name.
I_CLINT_NEVER_DISPLAY If the internal table refers to a structure which has client as key field, the client field can be suppressed from output by passing X to this parameter.
I_INCLNAME If the list output structure data declaration is not in the assigned TOP Include, the Include name can be specified here if no structure is specified.
CHANGING
CT_FIELDCAT Generated Field catalog.
7. REUSE_ALV_GRID_DISPLAY
This FM displays the data on the screen.
EXPORTING
I_INTERFACE_CHECK To avoid overloading list output with interface consistency checks, they are only made in an extra call mode. If this parameter is 'X', the consistency of the interface is checked when the function module is called, and an error log is output. This parameter should only be set for development test purposes (e.g. in debugging).
I_CALLBACK_PROGRAM Program which calls the function module and contains the exit routines. It must be a Report, Function group, Module pool or Form routine pool
(not an Include).
I_CALLBCK_USER_COMMAND Passing an EXIT routine tells ALV that the application wants to react to certain function codes itself. These are general function codes which ALV does not recognize (not ALV standard functions) and which were defined and set by an application
status.
I_BACKGROUND_ID ID of background gif image to be displayed in report header.
IS_LAYOUT Output list description structure.
IT_FIELDCAT Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).
IT_SPECIAL_GROUPS If fields have been grouped in the field catalog by a shared value of the parameter SP_GROUP, the technical key of the group (FIELDCAT-SP_GROUP) is assigned to the field group text in this internal table.
IT_SORT The caller specifies the sorting and/or subtotaling of the basic list in the internal table IT_SORT.
I_SAVE Controls the storage mode.
IS_VARIANT Variant information including the name of the list output variant.
IT_EVENTS This table tells ALV which events are processed by the caller by CALLBACK.
IT_EVENT_EXIT Table for passing ALV standard function codes, to return control to the user before and/or after execution with the callback event USER_COMMAND.
I_SCREEN_START_COLUMN Only to be used if the list is output in a popup.
I_SCREEN_START_LINE Only used if the list is output in a popup.
I_SCREEN_END_COLUMN Only used if the list is output in a popup.
I_SCREEN_END_LINE Only used if the list is output in a popup.
TABLES
T_OUTTAB Internal table with any structure containing the data to be output in list form. This table can contain more fields than are relevant for the list output (display fields and field list). Only the fields named in field catalog and the layout structure are used
for the list output. Other internal table fields are ignored.
give me u'r email Id for sending some nice documents of the same
Regards,
Santosh
Message was edited by: Santosh Kumar Patha<b></b>
2006 Mar 10 7:08 AM
Hi,
ALV is ABAP LIST VIEWER.
It is basically a control to which you just need to pass the data to be displayed and do a few settings and your report is done.
The basic advantage over the standared reports is it requires less coding efforts.
Also, it gives better control over the report fonctionality and disply.
You can learn more about ALV in detail in package SLIS.
It contains sample ALV programs.
http://help.sap.com is always there for help.
Regards,
Shashank
2006 Mar 10 7:10 AM
HI sunil
ALV is ABAP List Viewer.they are used to list the data in the grid or in a list.
there are lot of samples in SLIS package.
check out all the programs in SLIS package
regards
kishore
2006 Mar 10 7:11 AM
hi Sunil,
Welcome to SDN.
In ABAP, there are a total of 4 types of reports. They are:
Classical
Interactive
Logical Database
ABAP query
Also ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf. transaction se83) available from release 4.6 of SAP R/3.
ALV is available in two modes: list and grid. List mode is good old list processing with standard functionnalities, and grid mode is using a new OCX object displaying grids.
Advntages:
its main advantage is by using ALV technique we can find totals ,subtotals ,sort in any order etc there itself in the list output of course we need to write all those functionalities while using ALV...also many functional modules are defined under ALV concept
Other then this try these links :
http://www.sap-img.com/abap/abap-faq-2.htm
Hope these all will help you
Cheers
Sunny
Rewrd points , if found helpful
2006 Mar 10 7:12 AM
Hi sunil Deeraj
ALV's are Abap List Viewer , they are one of the type of reports, more specifically can be said as reports having more functionality.
ALV's concentrate more on bussines logic rather than thinking of formatting the layout , font , colors e.t.c
it is very simple to develop a ALV report.
step 1. extract all the data to be displayed in an internal table.
step 2. create a field catalog , which consist of the order of appearance of fields on the output.
step 3. pass the internal table to REUSE_ALV_GRID_DISPLAY
in the tables tab.
Your ALV is ready .
do reward points if found useful.
Regards,
Kishore Kumar Yerra.
attatched is the code for your reference.
data: i_qmel like qmel occurs 0.
select * from qmel into table i_qmel.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'QMEL'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_qmel
exceptions
program_error = 1
others = 2
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
2006 Mar 10 7:14 AM
Hi Sunil,
Welcome to SDN.
ALV stands for ABAP List Viewer.
It is a beautiful way of representing the report.
It includes features like downloading into excel,word etc and sorting,subtotals,totals and lots of other features without writing any code for it.So you cook your own report at very less time and your ALV gives a professional look to your report as well.With the introduction of Webdynpro for ABAP,ALV has been fully intergerted into it.So you can have your ALV on web too now.There are lots resources available on SDN for this beautiful topic.You check the knowledg pool http://help.sap.com,also www.sapgenie.com or
Also you search in your ABAP Editor for BCALV,You will get lots of sample ALV report which you can play around.
Regards,
Abdul
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |