GUIDELINE 6.20
Lists
ABAP_BACKGROUND
A list is a medium used for the structured and formatted output of data.
The following lists are available in ABAP:
Classical lists, which are written to a list buffer using ABAP
statements and displayed on a special list dynpro.
Output of the SAP List Viewer ( ALV ), which is displayed in
GUI controls during the processing of
classical dynpros. ALV lists are accessed using classes, such as
CL_SALV_TABLE (non-hierarchically
tabular lists), CL_SALV_HIERSEQ_TABLE
(hierarchically sequential lists), or
CL_SALV_TREE (hierarchically tabular lists).
Classical lists are the only option to send ABAP data from ABAP programs
directly to the SAP spool system as print lists. If
SAP List Viewer
is used, the lists that are displayed in the viewer are
automatically converted to classical print lists during printing.
ABAP_RULE
Use SAP List Viewer
Do not use classical lists. If dynpro-based, classical UI technologies
are still used, SAP List Viewer ( ALV ) or other GUI
control -based technologies should be used instead of classical lists
in production programs.
ABAP_DETAILS
Using classical lists is no longer recommended for the following
reasons:
The processing of lists is based on global data and events of the ABAP
runtime environment.
The list buffer that is used for classical lists is bound to an
executable program or a dynpro sequence and not to classes and objects.
It is almost impossible to separate presentation logic and application
logic when writing to lists.
The UI of a classical list is not standardized and thus usually not
accessible.
The concept of classical lists is therefore mostly incompatible with the
ABAP Objects concept, and classical lists cannot be encapsulated in
function groups as easily as classical dynpros and selection screens.
While the application developer must ensure
accessibility in classical lists with a
great deal of effort, the ALV lists automatically comply with the
accessibility requirements because the ALV already provides the
required services, such as user-specific settings.
Exception
Small helper programs that are not intended for live use in application
systems can continue to use classical lists for system-related console
output. The WRITE list statement here assumes the same role as
System.out.println(...) in Java or printf in C.
In cases in which an ALV output seems to be overdimensioned,
other methods are possible, such as Textedit Control or Browser Control
(or its wrapping in dynamic documents) for the formatted output of
non-tabular content. As before, accessibility must be guaranteed here.
Note
For simple console output, XML -based output streams can also be
used. An example of this is shown by the class
CL_DEMO_OUTPUT_STREAM . The class
CL_DEMO_OUTPUT demonstrates
possible applications of this class. It is used in programs in the
ABA Example Library .
Bad example
Executing the program
DEMO_CLASSICAL_REPORTING produces a classical list output.
However, according to the above rule, using classical lists in
application programs is no longer recommended.
Good example
Executing the program DEMO_ALV_REPORTING
produces ALV lists with the same content and the same
functions as the classical lists in the previous example. ALV
lists replace classical lists in those cases in which classical dynpros
are still used.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved