Professional Documents
Culture Documents
Objectives
The
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
Display
Graphics
Fields
Open For
Input
March-2005
ALV Programming
Two Approaches
Conventional (Using SAP Standard Function
Modules).
Object Oriented (Using SAP Standard Classes
and Methods).
March-2005
REUSE_ALV_VARIANT_DEFAULT_GET
REUSE_ALV_VARIANT_F4
REUSE_ALV_VARIANT_EXISTENCE
REUSE_ALV_EVENTS_GET
REUSE_ALV_COMMENTARY_WRITE
REUSE_ALV_FIELDCATALOG_MERGE
REUSE_ALV_POPUP_TO_SELECT
REUSE_ALV_LIST_DISPLAY
REUSE_ALV_GRID_DISPLAY
March-2005
Step 2 : Selecting the Variant for initial list display (Default Variant).
Optional : Used only if report layout is maintained through variant management.
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.
March-2005
output.
Optional : Required only if you need to display selection screen
values in the report
output.
functions
modules:
1. REUSE_ALV_FIELDCATALOG_MERGE
2. REUSE_ALV_LIST_DISPLAY
Or
REUSE_ALV_GRID_DISPLAY
March-2005
10
SAP Standard tables types taken from the type pools are:
SLIS_LAYOUT_ALV ,
SLIS_T_FIELDCAT_ALV,
SLIS_T_LISTHEADER,
SLIS_T_EVENT,
SLIS_SELFIELD.
March-2005
11
12
is_variant
I_TABNAME_HEADER
I_TABNAME_ITEM
IT_DEFAULT_FIELDCAT
I_SAVE
I_DISPLAY_VIA_GRID
IMPORTING
E_EXIT
ES_VARIANT
EXCEPTIONS
NOT_FOUND
PROGRAM_ERROR
OTHERS
March-2005
=
=
=
=''
=''
=
=
=1
=2
= 3.
13
14
SLIS_T_FIELDCAT_ALV.
The field catalog for the output table is builtup in the caller's coding. The build-up can be
completely or partially automated by calling
the REUSE_ALV_FIELDCATALOG_MERGE
module.
March-2005
15
16
Qtabname
17
March-2005
18
19
20
March-2005
21
March-2005
= 'BOX'.
= 'X'.
= 'X'.
" To optimize
= 'X'.
22
23
24
2.
REUSE_ALV_LIST_DISPLAY
OR
REUSE_ALV_GRID_DISPLAY
March-2005
25
26
EXPORTING
IMPORTING
I_CALLBACK_PROGRAM
March-2005
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_LIST_DISPLAY
AND
I_STRUCTURE_NAME
IS_LAYOUT
IT_FIELDCAT
IT_EXCLUDING
IT_SPECIAL_GROUPS
IT_SORT
IT_FILTER
IS_SEL_HIDE
I_DEFAULT
I_SAVE
IS_VARIANT
IS_PRINT
E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB
27
PAGE
* Data to be displayed
DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
* Selection
SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
28
Result:
REUSE_ALV_LIST_DISPLAY
March-2005
29
Demonstration
Creation of a simple ALV list report using the
March-2005
30
Practice
Creation of a simple ALV list report using the
March-2005
31
32
Result :
REUSE_ALV_GRID_DISPLAY
March-2005
33
Demonstration
Create a simple ALV grid report using the
March-2005
34
Practice
Create a simple ALV grid report using the
March-2005
35
Title
March-2005
36
wa_fcat-fieldname = 'CURRENCY'.
wa_fcat-no_out = 'X'.
APPEND wa_fcat TO i_fcat.
wa_fcat-fieldname = 'PLANETYPE'.
wa_fcat-no_out = 'X'.
APPEND wa_fcat TO i_fcat.
wa_fcat-col_pos = '3'.
wa_fcat-fieldname = 'CONNID'.
append wa_fcat to i_fcat.
wa_fcat-col_pos = '4'.
wa_fcat-fieldname = 'PRICE'.
APPEND wa_fcat TO i_fcat.
March-2005
37
Result :
PRICE
CONNID
FLDATE
CARRID
March-2005
38
Demonstration
Creating a simple ALV report by populating
March-2005
39
Practice
Creating a simple ALV report by populating
March-2005
40
p_rt_extab TYPE
" set_pf_status
41
Simple Program
Walkthrough:
Changing the Default Status
Bar of ALV (Contd.)
March-2005
42
March-2005
43
March-2005
44
Demonstration
Creating a simple ALV report by changing the
March-2005
45
Practice
Creating a simple ALV report by changing the
March-2005
46
Simple Program
Walkthrough : Adding
Function Codes
March-2005
47
Simple Program
Walkthrough : Make some
wa_fcat-col_pos
= editable
'4'.
Make theEditable
field PRICE
by updating the field catalog.
fields
To make PRICE
wa_fcat-fieldname = 'PRICE'.
field editable
wa_fcat-edit = 'X'.
March-2005
48
March-2005
49
Demonstration
Creating a simple ALV report by making one
March-2005
50
Practice
Creating a simple ALV report by making one
March-2005
51
Summary
ABAP List Viewer (ALV) is a simple, user friendly and better
March-2005
52
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?
How can we change the default status bar of an ALV List?
How can we handle custom function code in ALV ?
How can we make a certain columns of an ALV list
editable?
March-2005
53