Professional Documents
Culture Documents
March-2005
Objectives
The participants will be able to :
Describe the features and advantages of ALV.
Describe the different function modules that should be used to properly produce a report output in ALV. Create simple ALV reports. Format the layout of the ALV reports.
March-2005
March-2005
Advantages of ALV
Looks better.
User friendly
Filtering / Sorting Layout Change / Save Summation, Download to excel, E-Mail Data can be open for input / change etc.
Better Event handling Width of more than 256 characters possible Programming overhead of mentioning exact positions in write statements not needed.
March-2005
ALV Features
Email Change Layout Download to Excel Filtering Sorting Column Heading Row(s)
Selection
March-2005
March-2005
ALV Programming
Two Approaches
Conventional (Using SAP Standard Function Modules).
Object Oriented (Using SAP Standard Classes and Methods).
March-2005
March-2005
Step 3 : Defining output characteristics: preparing display Field-catalog. Step 4 : Build a table for Events, which are used for firing both user commands and the system dependent events i.e. top of page, end of page etc.
Optional : Required if the report has custom buttons, interactive properties etc or you need to display something at the top of page or end of page sections.
Step 5 : Build the Layout for report display. Continued to next slide
9 Overview of ABAP List Viewer (ALV) | 5.01 March-2005
Step 8 : Finally display report output, using the following ALV functions modules:
1. REUSE_ALV_FIELDCATALOG_MERGE
2. REUSE_ALV_LIST_DISPLAY
Or REUSE_ALV_GRID_DISPLAY
10
March-2005
Internal tables to be used in the program declared based on the above table types:
I_LAYOUT TYPE SLIS_LAYOUT_ALV, I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV, I_HEADING TYPE SLIS_T_LISTHEADER, I_EVENTS TYPE SLIS_T_EVENT. TYPES: KKBLO_SELFIELD TYPE SLIS_SELFIELD. DATA:
11
March-2005
Step 2: Selecting the Variant for initial list display (Default Variant).
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
* EXPORTING
I_SAVE specific ) CHANGING cs_variant and the * EXCEPTIONS * WRONG_INPUT * NOT_FOUND =1 =2 = Internal table containing the program name ( default variant: Optional ) = Variant save condition ( A=all, U = user-
* PROGRAM_ERROR
* OTHERS
.
=3
= 4.
12
March-2005
* EXPORTING
* I_SAVE CHANGING cs_variant * EXCEPTIONS = =''
* WRONG_INPUT
* NOT_FOUND * OTHERS * PROGRAM_ERROR = 4.
=1
=2 =3
14
March-2005
15
March-2005
16
March-2005
17
March-2005
18
March-2005
19
March-2005
20
March-2005
21
March-2005
22
March-2005
23
March-2005
The caller specifies the Sorting and/or Subtotaling of the basic list in the internal table IT_SORT.
This internal table has the following fields:
spos : Sort sequence fieldname : Internal output table field name tabname : Only relevant for hierarchical-sequential lists. Name of the internal output table. up : 'X' = sort in ascending order down : 'X' = sort in descending order
24
March-2005
1.
REUSE_ALV_FIELDCATALOG_MERGE
2.
REUSE_ALV_LIST_DISPLAY OR REUSE_ALV_GRID_DISPLAY
25
March-2005
26
March-2005
EXPORTING
E_EXIT_CAUSED_BY_CALLER ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB
IT_SORT
IT_FILTER IS_SEL_HIDE I_DEFAULT I_SAVE
IS_VARIANT
IS_PRINT
27 Overview of ABAP List Viewer (ALV) | 5.01 March-2005
* Data to be displayed
DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT. * Selection SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT. * Call ABAP List Viewer (ALV) CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_STRUCTURE_NAME TABLES T_OUTTAB = I_SFLIGHT. = 'SFLIGHT'
28
March-2005
Result: REUSE_ALV_LIST_DISPLAY
29
March-2005
Demonstration
Creation of a simple ALV list report using the function module REUSE_ALV_LIST_DISPLAY.
30
March-2005
Practice
Creation of a simple ALV list report using the function module REUSE_ALV_LIST_DISPLAY.
31
March-2005
* Data to be displayed
DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT. * Selection SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT. * Call ABAP List Viewer (ALV) CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_STRUCTURE_NAME TABLES T_OUTTAB = I_SFLIGHT. = 'SFLIGHT'
32
March-2005
Result : REUSE_ALV_GRID_DISPLAY
33
March-2005
Demonstration
Create a simple ALV grid report using the function module REUSE_ALV_GRID_DISPLAY
34
March-2005
Practice
Create a simple ALV grid report using the function module REUSE_ALV_GRID_DISPLAY
35
March-2005
Simple Program Walkthrough: Including Title in the Report for GRID DISPLAY
Title
In the PARAMETERS give I_GRID_TITLE = 'Flight Information and Call the function 'REUSE_ALV_GRID_DISPLAY'
36
March-2005
37
March-2005
Result :
38
March-2005
Demonstration
Creating a simple ALV report by populating the field catalog table, using the function module REUSE_ALV_GRID_DISPLAY.
39
March-2005
Practice
Creating a simple ALV report by populating the field catalog table, using the function module REUSE_ALV_GRID_DISPLAY.
40
March-2005
" set_pf_status
41
March-2005
Simple Program Walkthrough: Changing the Default Status Bar of ALV (Contd.)
42
March-2005
Simple Program Walkthrough: Changing the Default Status Bar of ALV (Contd.)
Call the function module REUSE_ALV_GRID_DISPLAY as:
I_STRUCTURE_NAME
I_CALLBACK_PROGRAM IT_FIELDCAT = i_fcat I_GRID_TITLE
= 'SFLIGHT'
= 'Y_DEMO_ALV_GRID'
TABLES
T_OUTTAB
43
March-2005
44
March-2005
Demonstration
Creating a simple ALV report by changing the default status bar, using the function module REUSE_ALV_GRID_DISPLAY.
45
March-2005
Practice
Creating a simple ALV report by changing the default status bar, using the function module REUSE_ALV_GRID_DISPLAY.
46
March-2005
During the Call to the function module REUSE_ALV_GRID_DISPLAY, another parameter I_CALLBACK_USER_COMMAND = USER_COMMAND'.
47 Overview of ABAP List Viewer (ALV) | 5.01 March-2005
add
wa_fcat-col_pos = '4'.
wa_fcat-fieldname = 'PRICE'.
wa_fcat-edit = 'X'. append wa_fcat to i_fcat. clear wa_fcat.
48
March-2005
49
March-2005
Demonstration
Creating a simple ALV report by making one of its column editable, using the function module REUSE_ALV_GRID_DISPLAY.
50
March-2005
Practice
Creating a simple ALV report by making one of its column editable, using the function module REUSE_ALV_GRID_DISPLAY.
51
March-2005
Summary
ABAP List Viewer (ALV) is a simple, user friendly and better looking reporting tool as compared to the usage of write statements in a conventional / interactive report. ALV report has several inbuilt User Friendly properties as:
Filtering / Sorting Layout Change / Save Summation, Download to excel, E-Mail Data can be open for input / change etc.
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_FIELDCATALOG_MERGE
Status STANDARD of the main program SAPLKKBL is copied and then changed to create a new customized GUI status for any ALV report.
52
March-2005
Questions
What is ALV ?
What are the main differences between an ALV report and a classical report?
What are the main function modules used to create an ALV List? What are the main differences between ALV list and ALV grid? What are the different ways to populate the FIELD CATALOG table?
53
March-2005