Tải bản đầy đủ (.pdf) (16 trang)

Tài liệu Appendix A: ABAP List Viewer (ALV) ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (252.06 KB, 16 trang )


Report Development Tools A–1
Appendix A: ABAP List Viewer (ALV)
Contents
Overview................................................................................................................. A–2
What Is The ABAP List Viewer?........................................................................... A–2
ABAP List Viewer: Cost Versus Benefit Analysis.............................................. A–3
Report Lists Without ABAP List Viewer.............................................................. A–4
Report Lists With ABAP List Viewer.................................................................... A–5
Technical Notes ..................................................................................................... A–9
Sample Code Using ALV (Release 4.0B)........................................................... A–10
Review .................................................................................................................. A–15
Where to Learn More........................................................................................... A–15


A
In this chapter you will
learn:
 Why the ABAP List
Viewer (ALV) is useful
 Some of the time-saving
features of ALV, as well as
its ability to enhance
information display
 The differences between
reports written with and
without the ALV
 Technical information
(sample code) to help you
build reports with ALV
“functionality”



Appendix A: ABAP List Viewer (ALV)
Overview

Reporting Made Easy

A–2

Overview
If it becomes necessary to write ABAP code to create your reports, then consider using the
ABAP List Viewer (ALV) to simplify your development. Available in the R/3 System since
Release 3.1, the ABAP List Viewer supports many of the standard R/3 reports. The ALV
provides additional program code you can quickly add to any custom report for any SAP
module.
Many reports developed for Release 4.0 (and later) utilize the ABAP List Viewer.
Additionally, many older standard R/3 reports (and reporting tools) have been modified to
include the ABAP List Viewer.
The ABAP List Viewer can be used with any application component or module in the R/3
System. We recommend that developers should adopt ABAP List Viewer as a design
principle in all report development activities that occur in your organization.


Note: At the time of press, limited technical support is available for the ABAP List
Viewer. However, we believe that support limitations should not prevent you from
taking advantage of the functionality offered by ALV.
What Is The ABAP List Viewer?
The ALV is a set of function modules that are added to program code. Programs created
before Release 3.1 can be enhanced with the ALV by adding links to the function modules.
Developers can use the functionality of the ALV when creating new reports, thus saving
time which might otherwise have been spent on report enhancement. Using the ALV also

provides a uniform user-interface and list format for ABAP reports. This standardization
helps eliminate redundant functions.
The ABAP List Viewer enables both simple and sequential (hierarchical) report lists. Simple
lists contain a number of non-hierarchical, user-defined columns. Sequential lists contain
columns that consist of column headings and their subordinate rows.

Goals of ALV
The primary goals of the ABAP List Viewer are to provide:
< Users with a consistent, user-friendly, and functional method of manipulating the
data which appears on report lists.
< ABAP developers with an efficient and consistent method of programming functions
that are commonly needed or requested in reports.
Appendix A: ABAP List Viewer (ALV)
ABAP List Viewer: Cost Versus Benefit Analysis

Report Development Tools
A–3

ABAP List Viewer: Cost Versus Benefit Analysis
Before taking advantage of the features of ALV, developers may want to consider the
benefits gained versus the “extra time” taken to include ALV in report development. The
following table shows estimates of time expenditures in report development. Note that an
estimated 50% of report developers’ time is consumed by building “fancy” features and
enhancing the look-and-feel of custom reports.

ABAP Report Development Activity Without ALV Percentage of Time Taken to Complete
Finding the right tables and table relationships that
need to be included in order for the program to be
written
50%

Providing “fancy” features, such as sorting,
subtotals, and interactivity
30%
Enhancing the look of the report with column
headings, vertical lines, and color
20%
Total 100%

SAP developed the ABAP List Viewer to help reduce the time and effort spent on some of
the report development activities. By using the ALV in the programming of custom reports,
you could reduce the development time by an estimated 40% (see table below).

ABAP Report Development Activity With ALV Percentage of Time Taken to Complete
Finding the right tables and table relationships that
need to be included in order for the program to be
written
50%
Preparing field catalog and sort sequence for ALV 1%
Providing “fancy” features, such as sorting,
subtotals, and interactivity
9%
Enhancing the look of the report with column
headings, vertical lines, and color
0%
Total 60%

Although, the use of ALV adds one more development activity (that is, preparation of the
field catalog), the development time spent on other activities is either eliminated or vastly
reduced.
Appendix A: ABAP List Viewer (ALV)

Report Lists Without ABAP List Viewer

Reporting Made Easy

A–4

Report Lists Without ABAP List Viewer
When a report is written, the report list (output) depends almost entirely on how the
developer programmed the report.
Shown below is a sample report list where the programmer did not to use the ABAP List
Viewer. For illustration purposes, consider a report that was simply written (using the
WRITE command) to the screen. The output of a report created with just the WRITE
statement is shown below:



A key point to note is that the function bar is blank. In addition, the data in the list is “dead”
which means that data listed cannot be used for any further data retrieval. It is essentially a
“data-dump.” Among other things, there are no headings for the columns. Any additional
functionality would have to be programmed. In short, the interface between the data you
see on the screen and the user’s eyes (the GUI) is limited and bland.
Report users routinely ask for additional features in their reports. Often they are looking for
the ability to:

Hint: These
functions are
all available
in ALV
< Sort
< Resize rows

< Double-click on one information element to jump to another information element
< Perform basic calculations
< Download “stylized” spreadsheets
< Display several colors
< Visually separate various pieces of information on the screen

Function bar is blank
List data is “dead.” It is simply
a so-called “data dump”
No column headings
Appendix A: ABAP List Viewer (ALV)
Report Lists With ABAP List Viewer

Report Development Tools
A–5

However, for the most part, these features need to be programmed into the list as added
functionality to the output of the report. While some of these added functions are relatively
easy to program, the manner in which this added functionality works may vary greatly. For
example, one programmer may decide to enable a single-click as sufficient user input to
jump to a next level of information, while another programmer requires a double-click.
Similarly, one programmer may set the output of a field at 10 characters long, but another
programmer may program it as 20 characters.
Report Lists With ABAP List Viewer
When you insert the ALV code in your ABAP report program, the report list comes “alive.”
Compare the ALV-enabled list shown on page A-6 with the list shown on the previous page.
Although the data is the same, the program has been changed to incorporate the ALV
function modules.
With the ALV, the user is presented with a standard interface which, from the outset,
includes:

< Headers for the columns that appear on the list.
< Colors that correspond to indented key information
< Buttons that appear on the function bar (some of whose functions will be introduced in
the pages that follow)


As you review the additional functionality shown above, remember that without the ALV
each function would have to be programmed into the report.
Function bar is blank
A feature-rich function bar
gives the user commonly
requested functionality
List data is “alive”
Column headings make data
easier to understand
Appendix A: ABAP List Viewer (ALV)
Report Lists With ABAP List Viewer

Reporting Made Easy

A–6



Note: This appendix introduces you to some of the functions that the ALV makes
possible. However, this appendix does not cover the full breadth of ALV functionality.
For more information, refer to the ALV documentation in the R/3 online documentation:
R/3 Library

CA-Cross-Application Components


General Application Functions

ABAP
List Viewer


Guided Tour

This guided tour shows possible ways a user could interact with an ALV-enabled report list.

In an ALV-enabled report list, a user can
select a particular column and execute a
subsequent function, if desired.
1. Select the column for Sales doc. With
ALV’s added functionality the color
of the selected column can be
changed, making it easy for the
report user to know which column
has been selected.
2. Choose Filter. With the filter option,
a user can call up a desired subset of
information on the output list.



3. Set the filter for the sales documents
to be viewed. In this instance, the
user only wants to views sales
documents that are between the

numbers 1000 and 2000.
4. Choose Copy to invoke the ALV to
filter the list.

1
2
3
4

×