The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help
Portal.
Note
This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.
2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP SE. The information contained herein may be changed without prior notice. Some software products marketed by SAP
SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are
provided by SAP SE and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP
Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set
forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional
warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE in
Germany and other countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.
Table of content
PUBLIC Page 1 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Table of content
1 SAP List Viewer (ALV)
1.1 Main ALV Classes
1.1.1 An Overview of ALV Tools
1.1.2 Display Types
1.1.3 ALV Output Display
1.1.4 Getting and Modifying Subobjects of a Main Class
1.2 Content of the ALV Output
1.2.1 Set Internal Data Table
1.2.2 Content and Structure Change
1.3 Areas of the ALV Output
1.3.1 Title of the ALV Output
1.3.2 Columns (General)
1.3.2.1 Change of DDIC Reference for a Column
1.3.2.2 Column Header
1.3.2.3 Lead Columns
1.3.2.4 Columns with Special Technical Meaning
1.3.3 Header and Footer Areas of the ALV Output
1.3.3.1 Design Object Compilation
1.3.3.2 Display List Header and Footer
1.3.3.3 Display Page Header and Footer
1.3.4 Special Functions of the Hierarchical-Sequential List
1.3.5 Special Functions of the Tree Structure
1.4 Basic ALV Functions
1.4.1 Sorting by Columns
1.4.2 Filter Data Rows
1.4.3 Making Calculations (Aggregation)
1.4.3.1 Make Settings for Aggregation
1.4.3.2 Results Rows
1.4.3.3 Generating Intermediate Results
1.4.4 Settings Management in Layouts
1.4.5 Selecting Cells, Rows and Columns
1.5 Determining the Appearance of the ALV Output
1.5.1 Color Definition for Columns, Rows and Cells
1.5.2 Setting Text Properties
1.5.3 Hiding Lines Between Columns and Rows
1.5.4 Changing the Display of Numeric Values
1.5.5 Define Column Width
1.5.6 Arranging a Data Record in Multiple Rows
1.5.7 ALV Output Display in a Dialog Box
1.6 Handling Events and Functions
1.6.1 Make Functions Available
1.6.1.1 Use of Generic ALV Functions
1.6.1.2 Using Self-Defined, Application-Specific Functions
1.6.2 Interactive Element Display
1.6.2.1 Checkbox Display
1.6.2.2 Display the Pushbutton
1.6.2.3 Internet Address Display
1.6.2.4 Click Area Display
1.6.3 Handling Single and Double Clicks
1.6.4 Handling Keyboard Actions
1.7 Providing Help for Users
1.7.1 Provide Tooltips
1.7.1.1 Tooltip Object Generation and Management
1.7.1.2 Generation of ToolTips for Icons and Symbols
1.7.2 F1 Help Provision
1.8 Making Settings for Printing
1.9 SAP List Viewer (ALV): Classic
PUBLIC Page 2 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
1 SAP List Viewer (ALV)
The SAP List Viewer (ALV) is an integrated element of the ABAP Objects programming environment. It allows application developers to quickly implement
the display of structured datasets by providing three different ALV tools, one each for the display of:
Simple and two-dimensional tables
Hierarchical-sequential lists
Tree structures
More information about the classes and methods, in particular their parameters, is available in the relevant system documentation. You can
find all classes for the object model in package SALV and its subpackages.
For new programming projects, we strongly recommend that you use the SAP List Viewer object model. The SAP List Viewer is also still
supported for a non-object-oriented programming environment. The SAP Library therefore also provides the associated documentation:
ALV Grid Control
The ALV is also available to you for programming projects that use Web Dynpro for ABAP as the presentation technology. More information:
SAP List Viewer in Web Dynpro for ABAP
Documentation for end users explaining the operation of ALV elements is available in the section:
Working With Lists
Use
You are using the ALV object model with one of the following main ALV classes:
CL_SALV_TABLE for the simple, two-dimensional table
CL_SALV_HIERSEQ_TABLE for the hierarchical-sequential list
CL_SALV_TREE for the tree structure
If you have decided on one of the ALV tools, you use the corresponding main ALV class to make all the settings that you need for the ALV output.
Structure
In the ALV main classes, you will find somewhat uniform methods that you use to provide the required specifications:
Minimum Information
In each of the three main ALV classes, you must call at least the following methods to obtain your desired ALV output:
You instantiate the main ALV class:
You define the internal data table that provides the structure and content of the ALV output, as needed.
You define which display type you want to use for the ALV output.
You display the ALV output on your screen.
PUBLIC Page 3 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
The following list includes some examples for methods that you are able to use in all three main ALV classes:
GET_COLUMNS
You get a reference to the individual column objects of the ALV output and make all the technical settings for a column.
GET_FUNCTIONS
You get a reference to the function object of the ALV output and use it to define which functions the user is able to use when working with ALV.
GET_EVENT
You get a reference to the events that you are able to process in the ALV output.
Depending on the main ALV class in which you are using these methods, they return objects of different types.
The following list includes some examples for methods that you are able to use only in specific main ALV classes:
GET_LEVEL
This method can only be found in the main ALV class CL_SALV_HIERSEQ_TABLE. There you get a reference to the objects in the two hierarchy
levels.
GET_NODES
This method can only be found in the main ALV class CL_SALV_TREE. There you get a reference to the node objects (rows) of the tree structure.
GET_SORTS
You are only able to sort in the simple, two-dimensional table or in the hierarchical-sequential list. This method is not available in the tree structure.
The Getting and Modifying Subobjects for a Main Class chapter includes the class diagrams for the three main ALV classes, along with
information on the getter methods that you use to retrieve the respective objects.
Hierarchical-Sequential List
Hierarchical-sequential lists consist of any number of rows that are divided into exactly two hierarchy levels. This differentiates between header and position
rows: position rows are subordinate to the header rows. For every header, there can be any number subordinate position rows.
Tree structure
In tree structures you display the table-type data in any number of hierarchy levels. The rows of the tree structure are called nodes. Every node, no matter
which hierarchy level it is on, has the same data structure. However, the nodes are related to one another hierarchically, such as superordinate or subordinate
nodes (parent-child relationship) or nodes on the same level (sibling-sibling relationship).
PUBLIC Page 4 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
1.1.2 Display Types
Definition
For the ALV output, independent of the ALV tool, you are able to choose between up to three display types:
Classic ABAP list
The ALV output takes up the whole screen. This means you are only able to display one ALV output. The screen is part of ALV.
Full screen display
The ALV output takes up the whole screen. This means you are only able to display one ALV output. The screen is part of ALV.
In a SAP GUI container
You create a container with class CL_GUI_CONTAINER in your screen. The ALV output is displayed in this container. With this type of display, you are
able, for example, to display more than ALV output on the screen or to mix the output with other SAP Enjoy controls.
You are also able to display the simple, two-dimensional table and the hierarchical-sequential list in a separate dialog box, the ALV popup.
Use
The table that follows shows which display types you are able to use in which ALV tool:
Some functions that you are able to apply with the ALV object model are not available in all display types. In the following chapters of this
document, you will learn which functions you can use where and where you cannot use them. In places where the functions differ, you will find
the following table:
Hierarchical-sequential list No
The gray fields here display that this display type is not available in the corresponding ALV tool.
The display types designated with Yes are the ones in which you can use the described function. At the end of each table you will find
information on how you can activate the function.
The display types designated with No are the ones in which the function is not possible.
Appearance
PUBLIC Page 5 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Above all, the classic ABAP list looks different from the other two display types:
The classic ABAP list looks like a traditional, row-oriented output. You only have limited options for formatting and using color. Especially in the areas
above and below the list, you are only able to use one font and very few text colors.
The full screen and the output in the container look very similar. Some elements appear three dimensional (for example, the column header as a
pushbutton); the font and colors are more varied. You are also able to use lines and other graphic elements.
However, you are only able to change the areas above and below the ALV output using the ALV object mode only in display types in which ALV has control
over the whole screen. There, various design options are available to you:
Application Toolbar
The only area outside of the actual ALV output that you can also influence in the container as well is the application toolbar. In the Classic ABAP List and
Full Screen display types; if you are using functions, this is located directly below the screen title. In the container display it is on the upper edge of the
container.
In the container displays, you change the application toolbar with the object model methods directly. In the other display types, you design the application
toolbar using the screen status.
Methods
The majority of methods in the ALV object model are valid no matter which display type you use for the ALV output. Nevertheless, there are a number of
differences, especially in the graphical design options, which means that some methods are not possible in specific display types. Read the system
documentation for the classes and methods.
Use
To display the ALV output on the screen, it is sufficient to use two methods of the ALV object model:
FACTORY
You instantiate the main ALV class:
You define the internal data table that provides the structure and content of the ALV output, as needed.
You define which display type you want to use for the ALV output.
DISPLAY
To display the ALV output on the screen, call up the method DISPLAY afterwards.
Examples
PUBLIC Page 6 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
data: gt_outtab type table of SFLIGHT.
data: gr_table type ref to cl_salv_table.
ls_binding-master = 'CARRID'.
ls_binding-slave = 'CARRID'.
t_binding_level1_level2 = lt_binding
importing
r_hierseq = gr_table
changing
t_table_level1 = gt_parent
t_table_level2 = gt_child.
gr_table->display( ).
PUBLIC Page 7 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
*... Select Data
IMPORTING
R_SALV_TREE = gr_tree
changing
t_table = gt_outtab2.
nodes = gr_tree->get_nodes( ).
loop at gt_outtab1 into ls_outtab.
try.
relationship = cl_gui_column_tree=>relat_first_child ).
node->set_data_row( ls_outtab ).
catch cx_salv_msg.
endtry.
endloop.
gr_tree->display( ).
Purpose
The ALV object model includes a large number of classes that you can use to make specific settings. The following graphic compares the class diagram of
the three main ALV classes.
PUBLIC Page 8 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Naming Conventions
The classes of the ALV object model are structured that you can usually tell from the names which areas of the ALV output you can change with the methods
from these classes.
Singular or plural
Often you will find class names that exist in both plural and in singular (such as CL_SALV_COLUMN and CL_SALV_COLUMNS). You can see from the
names that in the one class there are methods that only affect a specific object and in the other class the methods are for all of these objects.
ALV tool
Many functions are available for all three ALV tools. However, when there are differences between the classes of the ALV tools, you can find the right
variant by the name (such as CL_SALV_COLUMN_TABLE, _SALV_COLUMN_HIERSEQ, CL_SALV_COLUMN_TREE)
Get Subobjects
You get the objects for these classes using the Get methods of the three main ALV classes. The following table shows which methods in the main ALV
classes provide which subobjects:
GET_AGGREGATIONS CL_SALV_AGGREGATIONS
GET_COLUMNS CL_SALV_COLUMNS_TABLE or
CL_SALV_COLUMNS_HIERSEQ or
CL_SALV_COLUMNS_TREE
GET_EVENT CL_SALV_EVENTS_TABLE or
CL_SALV_EVENTS_HIERSEQ or
CL_SALV_EVENTS_TREE
GET_LAYOUT CL_SALV_LAYOUT
GET_PRINT CL_SALV_PRINT
If one of the classes uses another class, you can also get its objects using the Get methods.
CL_SALV_COLUMNS_HIERSEQ
CL_SALV_COLUMNS_TREE
GET_HYPERLINKS CL_SALV_HYPERLINKS
GET_TOOLTIPS CL_SALV_TOOLTIPS
CL_SALV_FUNCTIONS_TREE
Process Flow
If you have created the internal data table and the instance of the ALV main class, you are able to generate an object for each class used and make the
settings as well. To do this, proceed as follows:
You declare an object variable for each type of class that you want to use
(such as data: gr_display type ref to cl_salv_display_settings. )
PUBLIC Page 9 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
You use the respective Get method the main ALV class to get the objects of the corresponding type
(for example gr_display = gr_table->get_display_settings ( ). )
You use the methods of the class used to assign the desired properties to the object.
(For example
gr_display->set_striped_pattern(
value = 'X').
gr_display->set_vertical_lines(
value = 'X').)
When you have made the settings you display the ALV output with the display method.
The data table or its reference has to exist over the entire life of the application.
Due to the different data models upon which the three ALV tools are based, there are different requirements for the data tables that they transfer.
In the following chapters you will learn how to
Set the Internal Data Table
Proceed when the Structure or Content of the Internal Data Table Changes
Use
With the ALV tool, you display table-type structures. For this reason, your application's first task is to transfer a suitable data table to ALV. It does not matter
whether you transfer an existing database table (thus providing all DDIC information) or whether you define the fields of the data table yourself.
Based on various data models that are the basis for the ALV tools, you transfer different table tables to ALV depending on which ALV tool you are using:
Simple, two-dimensional table
The data table has a relational structure.
Hierarchical-sequential list
The hierarchy of the list is restricted to two levels. For each of these levels, you transfer an internal data table and link them with up to five foreign key
relationships
Tree structure
The table that you transfer to the ALV object model only contains the structure. There is no data in this table. To fill the tree structure, add the required
nodes in the form of NODE objects one at a time.
Features
You are able to make the following settings for data table:
First determine data table
Determine display of empty data table
Setting the Data Table for the First Time with FACTORY
To set the internal data table for the first time, always proceed in the same way no matter which ALV tool you are using: use the FACTORY method.
You can only use the FACTORY method the first time you call a table. To make changes to the table, read the chapter Changing and Updating
the Contents of the ALV Output.
Depending on which ALV tool you are using, the parameters of the FACTORY method are different:
Simple, two-dimensional table T_TABLE Table for structure and contents of the ALV output
PUBLIC Page 10 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Hierarchical-sequential list T_TABLE_LEVEL1 Table for header level
Tree structure No No
Methods
Use
You are able to change the internal data table in various ways. Depending on which type of change you use, you have to proceed differently to make the
change visible on the front end in the ALV output as well.
You are able to make the following changes:
You change content or the sequence of the individual data records
Afterwards you need to refresh the ALV output
You replace the entire data table
For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output
when you make the following changes:
Changes to the Display of Columns
Changes Sequence of Columns in the ALV display
Changes to the DDIC Reference of Columns
By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be
changed.
You are able to refresh the ALV output in two ways:
All settings for filters and sorting remain.
This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.
All settings for filters and sorting remain.
Features
For changes to content and structure, you are able to make the following settings:
Refresh ALV output
Swap the data table of the ALV output
PUBLIC Page 11 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
With the refresh, you ensure that the changed values are available on the front end as well.
Tree structure No No
Methods
Refresh ALV output without deleting filter and sort CL_SALV_TABLE REFRESH
settings CL_SALV_HIERSEQ_TABLE (Parameter REFRESH_MODE: SOFT )
Refresh ALV output and delete filter and sort settings REFRESH
(Parameter REFRESH_MODE: FULL )
If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-
type ALV outputs or all node objects in tree structures.
Methods
Change the Structure of the Data Table with the SET_DATA Method
Simple, two-dimensional table T_TABLE Table for structure and contents of the ALV output
Hierarchical-sequential list LEVEL Hierarchy level whose structure you wish to change
(in CL_SALV_HIERSEQ_TABLE)
T_TABLE New table of hierarchy level
PUBLIC Page 12 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
In the display types in the container, there are fewer areas available to you:
Additionally, especially the hierarchical-sequential lists and the tree structure have areas that do not exist in the other tools.
This chapter deals with the functions that you use to edit the various areas of the ALV output:
Title of the ALV Output
Columns
Results Rows for Calculations
Header and Footer Areas of the ALV Output
Areas in the Hierarchical-Sequential List
Areas in the Tree Structure
Use
The position of the title of the ALV output depends on which ALV tool you are using and also on the display type:
Simple, two-dimensional table
With the classic ABAP List and Full Screen display types, the title is located in the screen status. The title applies to the whole screen
In the full screen, you are also able to display the title above the ALV output.
With display in a container, the title is located on the upper edge of the container below the application toolbar. The title is valid only for the area of the
container
Hierarchical-sequential list
The title can be found in the screen status. The title applies to the whole screen
Tree structure
In the Full Screen display type, the title is located in the screen status. The title applies to the whole screen
With the display in the container, you cannot use a title.
Features
You can make the following settings for the title of the ALV output:
Change wording of the title
Change font size of the title (only container display)
Output Standard Title of the Report
Methods
PUBLIC Page 13 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Function Class Method
Hierarchical-sequential list No
Tree structure No No
Methods
Definition
Columns are the main element of an ALV output. You can define a number of properties for a column to change whether and how a value is displayed in the
column.
Column Description
In the ALV object model, a COLUMN object (class CL_SALV_COLUMN) is generated automatically for every column in your internal data table. All of the
COLUMN objects are represented by the COLUMN object (class CL_SALV_COLUMNS and its subclasses).
During generation of table instances, the ALV object model determines all relevant and available properties from the DDIC description of your internal data
table and assigns them to the individual column objects.
If table columns refer to local program fields, ALV is only able to determine a part of the possible column properties. These are mainly the
technical descriptions such as internal length, internal type and so on.
With the methods for class CL_SALV_COLUMN (or its subclasses), you define more properties as needed. The following graphic shows the inheritance
hierarchy of a column object:
Column Types
You are able to differentiate between the following column types:
Standard columns
Lead columns, which are columns that have a special textual meaning in your ALV output.
Special columns that control the meaning or display of other columns or that are reserved for special functions
Some of the settings that you make for a column are valid for all of these column types, but some are only reserved for a specific type of column.
Use
You are able to make the following settings for all columns.
Set the visibility of the column
Change Position of the Column within the ALV Output
PUBLIC Page 14 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Change Column Header
Columns with Special Meaning
Lead Columns
Setting the Properties of Text in the Column
Determining Appearance
Determining Width of a Column
Methods
CL_SALV_COLUMNS GET
For columns that you have defined as lead columns, you are able to determine whether the user can hide them or not.
You are able to determine which columns should not be included in the user's column set: You define the column as a technical column.
Most columns with special technical meaning are automatically technical columns and thus are not included in the users column set.
Methods
The exception column is always displayed as the first column. You cannot change its position.
Methods
PUBLIC Page 15 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get current position of a column GET_COLUMN_POSITION
Use
You are able to define columns as internal data tables yourself or you can use individual fields or whole tables from the database. In the latter case, all
information that is available for this element in the Data Dictionary (DDIC) is transferred to the new column objects. In the former case, only those are
transferred that you provide with the definition.
For columns with DDIC reference, you are able to retrieve a variety of information on the properties of the DDIC element.
You are also able to change description of column objects by creating or changing a DDIC reference. Here you have the following options:
You change the description of an individual column
You change the description of multiple columns simultaneously.
No matter whether the type of your column agrees with that of the referenced DDIC field, the following properties are always transferred to your column.
Short, medium and long text of the column header
F1 help text
If the typing also matches (internal type and internal length), the remaining properties are also transferred, such as
F4 help and search help
Data element and domain
Columns for amounts, currency, decimal places and rounding
Features
You are able to make the following settings for DDIC references:
Get information on the DDIC element
Change DDIC reference of an individual column or of multiple columns
Use F1-Help from Another DDIC Element
The following is valid for all of these functions:
Methods
If a column does not have a DDIC reference, you are able to retrieve the following properties:
Internal length
To do this, use the method GET_DDIC_INTLEN
Internal type
To do this, use the method GET_DDIC_INTTYPE
Methods
PUBLIC Page 16 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get DDIC reference for the column GET_DDIC_REFERENCE
Definition
The column header displays the name of a column for the user. You are able to define three different texts as column header.
Use
You are able to make the following settings for the column header:
Determine wording of the column header
Display or hide column header
Determine whether the user can sort the table according to this column by clicking on the column header
Determine tooltip for the column header
Display an icon (only tree structure)
A special case is the column header of the hierarchy column in the tree structure: Because there is no COLUMN object for this column, you
determine this column header using the properties of the tree structure.
Methods
Tree structure No No
Methods
PUBLIC Page 17 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
hidden
Hierarchical-sequential list No
Tree structure No No
Methods
Set column header as pushbutton for sorting the table CL_SALV_ SET_SORT_ON_
FUNCTIONAL_SETTINGS HEADER_CLICK
The tooltip for the hierarchy column in the in the tree structure is a special case: Because there is no COLUMN object for this column, you
determine this tooltip using the properties of the tree structure.
Methods
Get all tooltip objects for column headers of the tree GET_TOOLTIPS
structure
Display Icon
In the column header of the hierarchy column for a tree structure, you can display an icon.
Hierarchical-sequential list No
Methods
PUBLIC Page 18 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
1.3.2.3 Lead Columns
Definition
Lead columns are columns that have a special significance in the output. Usually you define columns that contain especially important content as lead
columns.
Columns that have already been designated by the application as primary key automatically become lead columns in the ALV object model.
The following properties differentiate a lead column from a normal column:
Lead columns have a different color. This color is determined by the system.
You are able to determine whether a lead column moves when you scroll sideways through the screen like the other columns, or whether it stays where it
is.
Lead columns can be found in the users column set. By default, the user is able to hide lead columns. You are able to prevent users from hiding lead
columns.
For all of the following functions, this is valid:
Tree structure No No
Use
You are able to make the following settings for lead columns:
Define the column as a lead column
Determine the color of individual cells in the lead columns
Prevent lead columns from scrolling
Prevent lead columns from being hidden
Methods
Methods
Methods
PUBLIC Page 19 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Preventing Lead Columns from Being Hidden
By default, users can hide or display columns that are part of their column set as needed. You are able to prevent users from hiding each lead column
individually.
Methods
Definition
As a rule, columns from the internal data table are displayed directly in the ALV output. However, you are able to define columns that have a special technical
function. These columns are then either not displayed at all or their content is presented in a special way. You are able to use the following types of special
columns:
Control columns
These columns are technical columns, which means they are usually not displayed. They contain information on how the contents are being displayed in
another column.
Examples of control columns are:
Color column (technical column)
Currency column (visible column)
Many of the properties that you assign to specific cells using control columns can also be assigned to a whole column (for example assigning
a currency to a whole column).
Graphic columns
To display icons, exceptions and symbols, you use specific notation (for example @AB@). So that these character strings are interpreted as IDs for a
graphic and not as text, you define the column accordingly as an icon-, exception or symbol column.
Columns with special function
These columns include functions that are only useful in very specific situations.
Examples of these columns include:
Expansion column for the hierarchical-sequential list
Text Column for Labels in Results Rows for Intermediate Results
Counter Column to Determine the Number of Rows
Use
Depending on how you use a special column, you need to be aware of different things.
An entry in the control column always refers to cells from those rows that include the entry as well.
There are two types of control columns:
Control columns that are fixed and assigned to a specific column.
Control Columns That Contain Information for Any Number of Columns
PUBLIC Page 20 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Column for decimal places SET_DECIMALS_COLUMN
GET_DECIMALS_COLUMN
In hierarchical-sequential lists you also have to specify in which of the two hierarchy columns the control column is located. To do this, use
one of the SET_*_COLUMN_LEVEL methods in the class CL_SALV_COLUMN_HIERSEQ.
Hierarchical-sequential list No
Tree structure No No
In the tree structure you are able to assign colors to nodes or to an individual item.
PUBLIC Page 21 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Use Graphic Column
In list-type ALV outputs, you are only able to display icons or symbols in columns that are specifically defined for this purpose. They may only contain entries
that uniquely identify an icon or symbol in your system.
Tree structure No No
In the tree structure you can display an icon in any item. To do this, use the method SET_ICON in the CL_SALV_ITEM class.
Methods
Exception Column
The exception column is a special form of the graphic column:
It displays a status of the current data record with specific icons.
The most common display of exception icons is the traffic light: You can display , the release status, for example, with these
icons.
As opposed to regular graphic columns, the exception column has additional properties:
The values in the exception column must be between 1 and 5
It can only display a specific set of icons. You are able to choose the icons you wish to display from several exception groups. In the exception column
itself, only the values allowed in this exception group are available
Users cannot hide the exception column
In list-type ALV outputs, the exception column is always displayed as the first column
Methods
GET_EXCEPTION_SETTINGS
(Parameter GROUP)
Results rows from aggregations remain empty in the exception column by default. In list-type ALV outputs, however, you are able to display
exception icons. To do this, in the class CL_SALV_COLUMNS_LIST, use the method SET_EXCEPTION_COLUMN (Parameter
CONDENSED). You check whether the results row is displaying an exception icon using the method IS_EXCEPTION_CONDENSED or
GET_EXCEPTION_SETTINGS
(Parameter CONDENSED).
You cannot use every exception group in every representation type of the simple, two-dimensional table or hierarchical-sequential list. The
following table shows where you can use which exception group.
2 LED No No Yes No
PUBLIC Page 22 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
3 STATUS No No Yes No
4 TREND No No Yes No
5 No No Yes No
MESSAGE
6 ALERT No No Yes No
7 No No Yes No
FAILURE/I
NCOMPLE
TE/
CHECKED
Expansion Column
This column is only available in the hierarchical-sequential list. You use it to specifically display and hide position rows for specific headers. Here you only
check whether an entry in a row of this column is included: if the cell is empty, only the position rows for the associated header are displayed. If the cell gets a
value, the position rows for the associated header are hidden.
Tree structure No No
Methods
Tree structure No No
Methods
Tree structure No No
Methods
PUBLIC Page 23 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get count column GET_COUNT_COLUMN
Definition
You are able to design the areas above and below the ALV output with various elements. To do this, you use design objects.
Various elements are available that you can use to compile a design object. Then you display them at your desired position.
You need to make various decisions in addition to the design questions:
In which ALV tool and in which display type are you using the design object?
Not all of the options described below are available in every variant.
In which output medium are you using which design object?
You are able to handle the output on the screen and the output in the printout differently.
At which position on the whole ALV output do you want the design objects to appear?
You are able to work with the following positions:
At the top of the whole ALV output (TOP_OF_LIST)
At the bottom of the whole ALV output (END_OF_LIST)
For multiple-page ALV outputs:
At the top of a page (TOP_OF_PAGE)
At the bottom of a page (END_OF_PAGE)
Use
You are able to make the following settings for design objects:
Design Object Compilation
Displaying a Design Object at Top or Bottom of the Whole ALV Output
Displaying a Design Object in Multiple Page ALV Outputs on Every Page
Use
You use the design object to design the area around the ALV output.
You put together a design object from a variety of elements of various types and then display it.
Element Types
You are able to use the following element types:
Header element (header info)
Text element with or without label (text label)
Action information
The elements only differ in appearance. No functions are linked to the various element types.
Layout Forms
You can arrange these elements within your design object. To do this, you choose between two layout forms:
Row-type layout
All elements are lined up in a row.
Table-type layout
You arrange the individual elements in rows and columns.
PUBLIC Page 24 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
You are able to combine the two layout forms with one another as you wish, that is, you can insert rows into a table and vice versa.
Restrictions
For Top of List, Top of Page, and End of Page a design object is not allowed to be more than one page long. If the design object is longer than one page, a
runtime error occurs or the display of the ALV output is negatively affected in some other way, depending on the position of the design object.
For End of List, there is no restriction on length.
For the Top of List design object, you can activate a special mode that makes it possible to wrap text within the design object. For more
information, see Display List Header and Footer.
By default, a page is 65 lines long. Ensure that the design object contains fewer than 65 lines.
Integration
A class is available for each element type:
Layout Class
Label CL_SALV_FORM_LABEL
Text CL_SALV_FORM_TEXT
Depending on the number of elements in your design object, you proceed differently:
If you only want to display one element, generate the associated object.
If you want to display multiple elements, generate the desired elements with the methods for the row- or table-type layout element and specify the desired
position within the layout element.
Features
Layout
The following functions are available for the layout forms:
Methods
PUBLIC Page 25 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
GRID SET_ELEMENT
(Parameter COLSPAN or ROWSPAN)
Element Types
You have similar functions available for the element types:
Methods
Specify the text element to which the label belongs CL_SALV_FORM_LABEL SET_LABEL_FOR
GET_LABEL_FOR
Example
The following example shows how you display an element of type Text at the end of the ALV output:
...
*... END_OF_LIST
exporting
text = 'MyText'.
gr_table->set_end_of_list( lr_text ).
...
The following example shows how you insert a design object with a table-type layout at the beginning of the ALV output:
...
*... TOP_OF_LIST
lr_label = lr_grid->create_label(
row = 1
column = 1 ).
lr_text = lr_grid->create_text(
row = 1
column = 2 ).
lr_label->set_label_for( lr_text ).
lr_text = lr_grid->create_text(
row = 2
column = 2 ).
gr_table->set_top_of_list( lr_grid ).
PUBLIC Page 26 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
...
Use
If you have compiled a design object you are able to display it in various places in your ALV output:
Before or after the ALV output as a list header or footer (Top of List, End of List)
In ALV outputs with multiple pages at the beginning or end of each page as a page header or footer (Top of Page, End of Page)
This section deals with the first of these types of design object.
Methods
Allow Top of List with more than maximum permitted CL_SALV_TABLE SET_MODUS
number of lines CL_SALV_HIERSEQ_TABLE
Sequencing: CL_SALV_FORM_CONTENT=>
Top of List, Top of Page C_MODUS_EXCEED_TOL_TOP
Sequencing: CL_SALV_FORM_CONTENT=>
Top of Page, Top of List C_MODUS_EXCEED_TOP_TOL_EOP
You must call method SET_MODUS in your application after you call method FACTORY.
Before you delete the instance of CL_SALV_TABLE or CL_SALV_HIERSEQ_TABLE or leave the program, reset method SET_MODUS back
to C_MODUS_STANDARD.
Display on the screen, both above and below the ALV output
Tree structure No No
Methods
To display the design object on the screen or on the printout, use the following methods:
PUBLIC Page 27 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Function Class Method
Use
If you have compiled a design object you are able to display it in various places in your ALV output:
Before or after ALV Output
In ALV outputs with multiple pages at the beginning or end of each page (page header or footer)
This chapter deals with the latter design object.
The information on page header and footer is only displayed in the output or the print preview of your ALV output.
Tree structure No No
In contrast to the design object above or below the entire ALV output (TOP_OF_LIST and END_OF_LIST), the page headers and footers are
events: If ALV determines that there is a page break when generating the printout, the END_OF_PAGE or TOP_OF_PAGE event is triggered.
ALV checks whether a design object is defined for this event and inserts at the correct position.
Features
Both in the TOP_OF_PAGE and in the END_OF_PAGE events, you are able to determine the actual number of pages using the PAGE parameter.
In the TOP_OF_PAGE event, you are also able to use the TABLE_INDEX parameter to get the table index of the entry. The table index is displayed on the
current page.
In order to be able to display the desired design object in the END_OF_PAGE event, you have to expressly reserve the required number of lines. To do
this, use the method SET_RESERVE_LINES in the CL_SALV_PRINT class. With the SET_RESERVE_LINES method you determine how many lines are
served.
Use
The hierarchical-sequential list allows you to combine two hierarchy levels such as header and position level in a display. To do this, specify two data tables
that have the same data type in at least one column. You use this column to create a relationship between the two tables.
You are able to generate a maximum of five of such foreign key relationships.
PUBLIC Page 28 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
In the hierarchical-sequential list, you are able to use the following special functions.
Determining Data Tables for the Header- and Position Level
Linking Data Tables for the Header and Position Level
Displaying or Hiding Position Rows
You use most of the functions of the hierarchical-sequential list analog to the simple, two-dimensional table (such as aggregation, sorting, filter). Here you also
have to specify for which of the hierarchy levels you want to execute the function.
Features
Methods
SET_DATA
(Parameter T_BINDING)
Methods
PUBLIC Page 29 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Special Functions of the Tree Structure
Use
The tree structure is comprised of the following areas:
The Structure
The structureis defined by the initial table that you specify with the FACTORY method. It is displayed by the column header, which is the top row of the
tree structure. Every node in a tree structure has exactly the structure that is defined in the initial table.
Hierarchy Column
The first column of the tree structure is always the hierarchy column. It is not part of the initial table. It contains symbols that the user can use to
display or hide lower levels of a node. Using different icons, you are able to display whether a node is a branch with subnodes or a leaf.
By default the hierarchy column has no text. However, for each node, you are able to determine which text is to appear in the hierarchy column.
Nodes
The actual entries in the tree structure are called nodes. Every node has the same structure as the initial table. Every node is uniquely identified by a
key.
A node can either be a leaf or a branch: Branches contain either more branches or leaves that are not subdivided any further as subnodes.
Item
Items are components of a node: Each node contains exactly as many items as are contained in the initial table. In this way you are able to compare
items with the entries in a column.
Based on the deviating data model, you are able to make some settings to the tree structures that are not available in the other ALV tools.
You are able to make the following settings for hierarchy column:
Determining Column Header (Section: Determining Wording of the Column Header )
Inserting Icons into the Column Header (Section: Display Icon )
Determining the Tooltip for the Column Header (Section: Determining the Tooltip for the Column Header )
Define text for the node
Determine icons for expanded and collapsed branches
Display leaf as branch
You are able to make the following settings for nodes:
Get node objects
Generate, move and delete nodes
Collapse and expand branches
You are able to make the following settings for items:
Determine value
Set Display of the Item
Set selectability
Features
For all of the following functions, this is valid:
Hierarchical-sequential list No
PUBLIC Page 30 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Top node GET_TOP_NODE
Methods
Move node to another position within the tree structure CL_SALV_NODE MOVE
Methods
Methods
PUBLIC Page 31 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
A node that is displayed as a branch although it contains no subnodes is also called an empty folder.
Methods
Instead of displaying the icon for leaves, show the icon CL_SALV_NODE SET_FOLDER
for a collapsed branch
When the user expands an empty folder, the event EXPAND_EMPTY_FOLDER from the class CL_SALV_EVENTS_TREE is triggered.
Methods
If you exchange the content of the whole node, the structure of the new one must exactly match the one specified by the initial table.
Methods
The user can only change the value of checkboxes that are enabled.
Methods
PUBLIC Page 32 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Check value of a checkbox IS_CHECKED
When the user changes the value of a checkbox, the event CHECKBOX_CHANGE from the class CL_SALV_EVENTS_TREE is triggered.
If the user clicks on an item of type Pushbutton (BUTTON) or Link (LINK), the event LINK_CLICK from the class CL_SALV_EVENTS_TREE is
triggered.
Methods
Use
You are able to change the sequence of data records according to specific rules by sorting the ALV output. You specify which column includes the value that
is to be sorted alphabetically or numerically, determining the sequence of all rows.
You are able to specify up to nine columns that can be used to sort the ALV output.
Control Level
Data records have the same value in a sorted column for a control level. If this value changes in regard to the next data record, it is called a control level
change.
You have various options to highlight a control level change.
Integration
The sort settings for a column are represented by an object of type CL_SALV_SORT. The total of all the sort objects is represented by an object of type
CL_SALV_SORTS.
You are able to make calculations using the values of numeric columns. By default all values of a column are used for this. If you need intermediate results in
addition to the overall result of the calculation, the rows that contain the subvalues of an intermediate result need to be next to each other: They sort the ALV
output. The sort is then a prerequisite for ALV being able to determine and display intermediate results.
Features
You are able to make the following settings for sorting:
PUBLIC Page 33 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get sort objects
Create and delete sort objects
Set sort direction
Set column sequence of sorting
Forbid changes
Highlight control level change
For all of the following functions, this is valid:
Tree structure No No
Methods
Methods
If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Methods
CL_SALV_SORT SET_SEQUENCE
Methods
SET_POSITION
Forbid Changes
PUBLIC Page 34 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
By default, the user can change sort settings that you have specified using the application. However, you are able to expressly forbid this.
Methods
CL_SALV_SORT SET_OBLIGATORY
Prerequisite
You have activated grouping of the ALV output.
Methods
CL_SALV_SORT SET_GROUP
Use
With filters you restrict the display of data records in the ALV output. To do this, you specify conditions that a record in a specific column has to fulfill in order
to be displayed or filtered out.
Like the sort object, you are able to generate a maximum of one filter object for each column. Every filter object can include on or more filter conditions.
Classes
The total of all the filter objects is represented by an object of type CL_SALV_FILTERS. The filter settings for a column are represented by an object of type
CL_SALV_FILTER. The individual filter conditions in a filter object are represented by objects of type CL_SALV_SELOPT.
Filter Condition
In a filter condition, you provide information on which data records are to be displayed:
The column in which the tested content is located
The comparison value with which the rows are tested. This can be an individual value or an range for the given value.
The condition, that is, an operator that defines the necessary relation between the cell value and the comparison value (for example, greater than, less than
or equal to)
Exclusion or inclusion, that is, whether the rows that fit the condition are to be displayed or whether they are not to be displayed
All entries that have the value AA in the CARRID column should be displayed.
...
gr_filter->add_filter(
columnname = 'CARRID'
sign = 'I'
option = 'EQ'
low = 'AA' ).
PUBLIC Page 35 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
...
Features
You are able to make the following settings for aggregations:
Get filter objects and filter conditions
Generate and Delete a filter object and filter condition
Forbid filters for a column
The following is valid for all of these functions:
Tree structure No No
Methods
You are only able to generate a filter object for columns in which you have not expressly forbid this (see the Forbidding Filters for a Column ).
Methods
PUBLIC Page 36 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get inclusion or exclusion GET_SIGN
If you assign a new data table with a new structure to your ALV output, all filter objects will be deleted automatically.
Methods
Use
You are able to make calculations in columns with a numeric data type: You generate an aggregation object. The result of the calculation is then displayed in a
separate results row.
Intermediate Results
Usually all values in a column are used in a calculation during aggregation. You are also able to obtain intermediate results. To do this you have to sort the
ALV output and group the rows that you want to use for the intermediate result.
Prerequisites
The column that you are aggregating has a numeric data type.
Features
You are able to make the following settings for aggregations:
General Settings for the Aggregation Object
Settings for the Results Rows
Settings for Intermediate Results
Use
You are able to make various settings for the calculation of columns. The following types of calculation are available:
Total
Adds all values for the column
Minimum
Determines the smallest value for the column
Maximum
Determines the largest value for the column
Average
Determines the geometric average of all values in the column
You are able to create a maximum of one calculation for every column. The result of the calculation is then displayed in a separate Results Row.
The settings for calculations (aggregation settings) for a column are represented by an object of type CL_SALV_AGGREGATION. The total of all the
aggregation objects is represented by an object of type CL_SALV_AGGREGATIONS.
In addition to the calculation types listed above, you are also able to determine the total data records (see also Columns with Special Technical
Meaning, the section on Counter Column to Determine Number of Rows ). The result is displayed in the results row. The row count, however,
is not represented by an aggregation object.
Features
You are able to make the following settings for aggregations:
PUBLIC Page 37 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Getting Aggregation Object
Creating and Deleting Aggregation Object
Determine the Type of Aggregation
Determining the Position of the Results Row
Allow and Forbid Aggregation
The following is valid for all of these functions:
Methods
By default, columns with the numeric text (NUMC or n) data type cannot be aggregated. In these types of columns, you can only create an
aggregation object if you expressly permit this.
You can also only forbid aggregation for columns that can be aggregated.
Methods
If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Methods
CL_SALV_AGGREGATION SET
Methods
PUBLIC Page 38 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Function Class Method
Definition
You are able to perform various calculations for numeric columns in the ALV output and then display them in a results row.
You are also able to sort the data records according to specific criteria and generate the intermediate results for each calculation. These intermediate results
are also displayed in the results row.
Beyond the options described here, you are not able to affect the content and appearance of the results row.
Use
You are able to make the following settings for results rows:
Determining the Position of the Results Row
Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions )
Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns , Exception Column )
Methods
Use
By default all values in a column are used in the calculation during aggregation. However, you are also able to generate intermediate results. You group the
data records that contain the values for an intermediate result and display each intermediate result in its own results row.
You are also able to generate aggregations in and display intermediate results in the tree structure. However, here the intermediate results are
automatically generated from the values of the subnodes in every node that has subnodes. The following information is thus only valid for the
simple, two-dimensional table and the hierarchical-sequential list.
To generate intermediate results you have to provide certain information:
PUBLIC Page 39 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
To specify in which column the values from which the intermediate results are calculated are located, generate an aggregation object for the desired
column. The overall result is displayed in the results row.
To specify which data records are contained in an intermediate result, group the data records: You sort the ALV output by the column that includes the
criterion for the intermediate result.
To then display the intermediate results, you calculate the intermediate results using the column with the criterion.
The most common way of generating intermediate results is to use subtotals. That is way you often find this term in place of intermediate
results for all aggregation types. Nevertheless you can of course generate intermediate results (or subtotals) for all other aggregation types.
Prerequisites
You have generated an aggregation object for at least one aggregatable column.
The column with the criterion for intermediate results is a column that cannot be aggregated.
You are able to generate intermediate results for up to nine columns.
Features
You are able to make the following settings for intermediate results:
Generating Intermediate Results
Hide Subvalues of Intermediate Results
Determining the Position of the Results Row
Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions )
Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns , Exception Column )
For all of the following functions, this is valid:
Tree structure No No
The column that contains the sort object has to have one of the following data types:
alphanumeric data type
or
Numeric text (NUMC or n), assuming you have not expressly permitted aggregation for this data type (see chapter Making Settings for
Aggregation , Section Allow and Forbid Aggregation )
Methods
CL_SALV_SORT SET_SUBTOTAL
Methods
Check whether the rows for an intermediate result are CL_SALV_SORT IS_SUBTOTAL_COMPRESSED
hidden or displayed
PUBLIC Page 40 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Use
In a layout, users are able to save information on column structure, sorting criteria, filter conditions and various display options, and so on. In this way, they
are able to display their ALV outputs with the same properties every time.
You are able to use your application to affect the options that users have for using layouts.
You are not able to use the ALV object model to either create or delete layouts.
User-specific layouts and layouts for all users also differ in their names:
The names of user-specific layouts start with a letter (A-Z).
The names of layouts for all users start with '/'.
The names of standard layouts provided by SAP start with a number (0-9).
Layout Key
All layouts for all applications are saved centrally. To enable a layout to be assigned to your application, set a layout key. All layouts that users save to your
application can then be identified with this layout key and a name.
Features
You are able to make the following settings for layouts:
Get layouts
Set layout key
Determine for whom users can save layouts
Change layout for start of the ALV output
Display dialog box for layout
The following is valid for all of these functions:
Get Layouts
You are able to get the settings for layouts that users have saved for your application.
Methods
Methods
PUBLIC Page 41 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Only for other users (for all users)
For both themselves and for other users
Methods
Methods
Methods
Use
You are able to use your application to determine which areas are selected when the ALV output is being displayed. In the simple, two-dimensional table and
hierarchical-sequential list, you are also able to change whether and under what conditions users are able to select areas of the ALV output. To do this, use
the selection type in list-type ALV outputs. In tree structures, you determine whether each individual node or item can be selected or not.
Current Cell
The current cell indicates the position of the cursor in the simple, two-dimensional table and the hierarchical-sequential list. The current cell is highlighted
differently from the selected cells. In this way you are able to recognize the current cell when you are in a selected area.
Features
You can make the following settings for the selection in the ALV output:
Get settings for selection and information on the selected areas
Set selection type
Enable selection of nodes and items
Select area
Methods
PUBLIC Page 42 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Get a selection object for a hierarchy level CL_SALV_HIERSEQ_LEVEL GET_SELECTIONS
Tree structure No No
Methods
Hierarchical-sequential list No
Methods
Select Area
You are able to set selections in the ALV output using your application.
PUBLIC Page 43 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Hierarchical-sequential list Yes
Methods
You are only able to change the font in full-screen display or in display in a container, not in the classic ABAP list.
You can make the following settings for the appearance of the ALV output:
Defining Colors for Columns, Rows and Cells
Setting Text Properties
Hiding Lines Between Columns and Rows
Changing the Display of Numeric Values
Determining Column Width
Arranging a Data Record in Multiple Rows
Designing Header and Footer Areas of the ALV Output
Use
You are able to assign different colors to the columns, rows and cells of your ALV output table. A set of colors is available for this purpose that you can use
with few restrictions.
PUBLIC Page 44 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
In both of the other tools you are able to change the combinations of text and background color to a certain degree:
You choose a color from a set of possible colors.
You determine whether this color is to be light or dark (intensity)
You determine whether the color applies to the background or the text (inverse display)
GUI-Dependent COL_BACKGROUND
Yellow COL_TOTAL
Green COL_POSITIVE
Red COL_NEGATIVE
orange COL_GROUP
The color COL_KEY is the color that the system uses for Lead Columns.
Features
You are able to make the following settings for colors:
Lead Columns have a color determined by the system. In lead columns you are only able to change the color in individual cells.
In list-type ALV outputs, you are able to color in rows or cells using the Color Column. You color in whole columns by changing the color property of the
column.
In the tree structure, however, you can color in nodes and items directly using the associated methods. You are not able to color in columns here.
You can present the entire ALV output with stripes, that is automatically color in the rows of the ALV output alternating light and dark.
You are only able to change the color of a column if it is not a lead column.
Tree structure No No
Methods
Hierarchical-sequential list No
Methods
PUBLIC Page 45 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Display Rows with Stripes
You are able to color the rows of the ALV output alternating light and dark.
The colors for both shades are defined by the system and you cannot change them.
Tree structure No No
Methods
Use
You are able to change the display of text in the ALV output. Depending on whether the text is located in the ALV output itself or in the header of the list, for
example, you have different options.
The following sections mainly deal with how you change the display of alphanumeric columns. With numeric columns there are additional
options. For more information about this, see changing the display of numeric values.
Features
You are able to make the following settings for text properties:
Set font
Set alignment of the text in the column
Determine lowercase and uppercase
Determining display of empty cells
Changing text color
Set Font
You are able to change the font of text in the design object (header and footer area of page or list) and in the tree structure.
PUBLIC Page 46 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
This is how you set the font in the design object using a choice of element type.
Hierarchical-sequential list No
Methods
Methods
PUBLIC Page 47 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Simple, two-dimensional table Yes Yes Yes
Methods
Methods
Methods
Use
You are able to separate the rows and columns from one another with lines, both in the ALV output and in the design object (header, footer area). Color and
thickness of the lines are determined by the system. You cannot change them.
Features
You are able to make the following settings for lines:
Hide lines between columns and rows
Display lines in the design object of the header and footer areas of a list or page
Display Lines Between Control Levels ( Highlight Control Level Change section)
PUBLIC Page 48 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Display type Classic ABAP list Full screen In the Container
ALV Tool
Tree structure No No
Methods
Methods
Use
You are able to determine how a numeric value from the internal data table is to be displayed in the ALV output. To do this, you can use the following
properties:
Number of decimal places
Unit of measurement
Currency
Rounding
With each of these properties, you either move the decimal point the desired number of places (thus changing the value of the number) or you change the
number of decimal places after the decimal point (the value of the number then stays the same). You are also able to combine two or more options.
You are able to apply each of the properties in two ways:
You assign the desired property with a specific value to the column that contains the values to be displayed. Each of the values in the column is changed
and displayed in the same way.
You use a separate column that applies the desired property to individual rows of the ALV output. For more information, see Columns with Special
Technical Significance, in the section called Control Columns That Are Assigned to a Column .
Features
You are able to make the following settings for numeric columns:
Setting properties such as number of decimal places, units of measure, currency and rounding
Displaying or hiding sign
Hide or display leading zeros
Determining Display of Empty Cells
The following is valid for all of these functions:
PUBLIC Page 49 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Display type Classic ABAP list Full screen In the Container
ALV Tool
Methods
For columns with DDIC reference, the GET_DDIC_DECIMALS of class CL_SALV_COLUMN returns the number of decimal places that is set
for the referenced data element.
Methods
Methods
Use
You are able to change the width of the columns in the ALV output in different ways. Here you differentiate between columns in the content of the ALV output
(represented by a COLUMN object) and other types of columns (such as hierarchy column of the tree structure, column in design object).
PUBLIC Page 50 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Features
You are able to make the following settings for column width:
Set output width of a column (COLUMN object)
Set width of hierarchy column in the tree structure
Change width of a column in table-type layout of a design object
Adapt width to space needed for the values
Hide column completely (section called Settings Visibility of a Column)
Methods
Hierarchical-sequential list No
Methods
Methods
PUBLIC Page 51 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Check whether all columns are optimized IS_OPTIMIZED
In the printout, the columns that are output are exactly as wide as they are on the screen by default. In the full-screen display of a simple, two-
dimensional table, you are able to determine that the column widths be optimized in the printout. To do this, use the method
SET_COLUMN_OPTIMIZATION in the CL_SALV_PRINT class. With the IS_COLUMN_OPTIMIZATION you check whether the columns are
optimized in the printout.
Use
You are able to arrange the values of a data record in multiple rows. For example, you are able to ensure that all of the data is visible simultaneously even
when there is a large number of columns.
If you spread a data record over multiple rows the ALV output is automatically displayed with stripes.
Features
For each individual column you determine in which row of a data record you wish to display your values.
Tree structure No No
Methods
Use
You are able to display the ALV output in a separate dialog box, the ALV popup. Here you are able to use all functions of the currently applicable ALV tools as
usual.
Screen Status
When you display the ALV output in a separate dialog box, the screen status SALV_TABLE_STDPOPUP (function group SALV_METADATA_STATUS) is
automatically used. If you want to change this screen status, make a backup copy of the original screen status beforehand and then make your desired
changes.
Features
You are able to make the following settings for the ALV popup:
Display ALV output in a dialog box
Specify the size of the dialog box
The following is valid for all of these functions:
Tree structure No No
PUBLIC Page 52 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Display ALV Output in a Dialog Box
You display the ALV output in the dialog box by specifying the position of the dialog box on the screen. This is measured in columns and rows of characters:
each character corresponds in width to one column, in height to one row.
You specify the distance between the dialog box and the left side of the screen in columns and from the top of the work area in rows.
Methods
Methods
PUBLIC Page 53 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
In every event handler method, you are able to change the content of the data table, for example. Then you need to refresh the display with the
REFRESH method.
Use
By default, there are no functions available to users for working with the ALV output. Even the basic functions, such as sorting, filtering, printing and so on are
not available with the simplest call of an ALV output. In order to allow the user to make use of a function, you have to expressly make it available.
Functions are divided into two groups:
Generic ALV Functions
You are able to enables these functions independent of the objectives of your application. Generic ALV functions are sorting, filtering, managing layouts,
printing, and so on.
Custom Application-Specific Functions
You use your application to provide functions that are specially customized to the requirements of this application. In the ALV output, you make
pushbuttons available with which users can trigger the function.
Screen Status
When you display a tree structure or a simple, two-dimensional table in a container, simply specify your desired functions with the appropriate setter method.
In the following display types, on the other hand, ALV controls the entire screen:
Simple, two-dimensional table in full screen
Hierarchical-sequential list
Tree structure in the full screen
Here you can decide which screen status will be used and also which functions will be offered to the user as menu entries and which ones will be offered as
pushbuttons. In these display types, you are only able to display those functions that you have also entered into the screen status.
Features
Do not change the original screen status. If you want to make changes to the screen status, for example because you want to make custom
functions available, use the original screen status as a copy template and then change the copy as needed.
You are able to set another screen status.
Methods
PUBLIC Page 54 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Use
You are able to provide functions so that users can work with the ALV output. The functions that the system provides for ALV are called generic ALV
functions. Generic ALV functions include sorting, filtering, layouts settings and so on. Generic means that the system checks whether a function is useful for
a specific situation. It enables or disables the pushbutton or menu entry accordingly. On the other hand, with self-defined functions, the system cannot
influence the activation status.
The names of all generic ALV functions are listed as constants in the interfaces IF_SALV_C_FUNCTION LIST (for the simple, two-
dimensional table and the hierarchical-sequential list) or IF_SALV_C_FUNCTION_TREE (for the tree structure).
You are only able to set a function as a menu entry using the screen status. In the container display you are not able to influence the menu
structure.
Function Groups
You are able to enable or disable every generic ALV function. Most generic ALV functions however, are part of groups of functions that have been grouped
together logically. In this way, you are able to enable all of the functions for this group with one command.
Features
You are able to make the following settings for generic ALV functions:
Get function settings
Enable generic ALV functions
Check visibility and activation status of a self-defined function
The following is valid for all of these functions:
Methods
PUBLIC Page 55 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
You enable each generic ALV function individually
You enable a function group. All of the functions for this function group are enabled simultaneously
You enable all generic ALV functions simultaneously
In the list-type ALV outputs (simple, two-dimensional table and hierarchical-sequential list), there is also a preset default selection of the most
frequent generic ALV functions.
Methods
You set the group Filter , making the functions SET_FILTER and SET_FILTER_DELETE visible. As long as you have not defined a filter, the
function SET_FILTER_DELETE remains disabled.
You are able to check the activation status of a self-defined function However, the associated method does not include the activation status that the system
has set based on its internal logic.
When you try to change the activation status of a generic ALV function, you get an error.
Methods
Use
You are able to provide functions that are specially customized to your application. To allow users to use these functions, you display pushbuttons or, as
long as you have access to the screen status menu entries.
In the container display, you are only able to add pushbuttons in the application toolbar. You are not able to generate menu entries.
In the other display types, you use the screen status to set the position of a pushbutton or the menu entry. The pushbutton is then displayed at the
position set here no matter in which sequence you create the functions.
Features
PUBLIC Page 56 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
You are able to make the following settings for self-defined functions:
Get function settings
Create and display self-defined functions
Check visibility and activation status of a self-defined function
Instead of a self-defined function, execute a generic ALV function
Methods
Hierarchical-sequential list No
Methods
PUBLIC Page 57 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Tree structure Yes Yes
Hierarchical-sequential list No
Methods
Hierarchical-sequential list No
Methods
Use
In the content of your ALV output, you are able to display various elements in place of text. Some of these elements can be treated as a click area for the
user. You are able to display the following elements:
Checkbox
In list-type ALV ouputs, the checkbox is disabled. With the content of the column, you are only to display whether the checkbox is set or not.
In the tree structure, however, you are able to handle users actions on this element using an event.
Pushbutton
You are able to handle user actions on this element with an event.
Hyperlink
You specify the Internet addresses (URLs). Users can then call up the corresponding page in the Internet browser by clicking on one of these Internet
addresses.
Click Area
You are able to handle user actions on this element with an event.
In list-type ALV outputs, the setting for interactive elements is called cell type. In tree structures it is called type of item.
Features
You are able to make the following settings for interactive elements:
Get current setting
Assign cell type or type of item
PUBLIC Page 58 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
In list-type ALV outputs, you are able to assign the cell type in two ways:
All cells of a column get the same cell type. Here the cell type is thus a property of the column.
Using a column for cell types, you assign any cell type to each of the individual rows.
In the tree structures, on the other hand, the type is a property of the item.
Depending on of what the cell / item type is a property, you proceed differently to obtain the current settings.
Methods
CL_SALV_NODES GET_NODE
CL_SALV_NODE GET_ITEM
GET_HIERARCHY_ITEM
CL_SALV_ITEM GET_TYPE
Methods
Use
A checkbox displays two statuses: the indicator is set (a checkbox is displayed in the field) or it is not set (the field is empty).
Both statuses can be overwritten by the activation: if a checkbox is enabled (the field is white), the user can change the status of the checkbox by clicking on
it. If the checkbox is disabled (the field is gray) a click does not change anything.
You are able to display your ALV output in cells or items.
In the class ABAP list and the hierarchical-sequential list, you are able to use display type to determine that a checkbox be displayed in front
of every row for the user to select the row.
You are able to display checkboxes in all ALV tools. In the classic ABAP list and the hierarchical-sequential list, however, you are not able to activate the
checkboxes, which means the user is not able to change the value of a checkbox.
PUBLIC Page 59 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Checkbox enabled CHECKBOX_ 0 or
Indicator not set HOTSPOT
Features
You are able to make the following settings for checkboxes:
Display checkbox (assign cell and item type)
Enable/disable checkbox in the item
Set/remove indicator for the checkbox in the item
Checkbox Display
To display a disabled checkbox in a list-type ALV output, use the cell type CHECKBOX .
To display an enabled checkbox in the simple, two-dimensional table (full screen or container), use the cell type CHECKBOX_HOTSPOT .
To display a checkbox in a tree structure, use the type of item CHECKBOX
Hierarchical-sequential list No
Methods
Hierarchical-sequential list No
Methods
PUBLIC Page 60 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Pushbutton Display
Use
Pushbuttons help users to trigger an event that you are able to process as needed. You are able to display pushbuttons in the ALV output. The value of the
cell is then displayed as a label for the button.
These are valid for the functions of pushbuttons:
Hierarchical-sequential list No
If users select a pushbutton, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_TREE)
...
Features
You are able to make the following settings for pushbuttons:
Display pushbutton (assign cell and item type)
Use
You are able to manage any number of Internet addresses as hyperlink objects. Each of these hyperlink objects is identified by a unique key. You are able to
display any one hyperlink object in any cell. To do this, use the hyperlink column (see Columns with Special Technical Meaning, section Control Columns
That Contain Information for Any Number of Columns ). The contents of the hyperlink column then show the affected cell. The affected cell then includes the
key for the hyperlink object.
Columns that contain the key for the hyperlink object have data type INT4.
You can also determine that the Internet address that is displayed in the cell has been enabled as a click area. This means, when the user clicks on the
Internet address, an Internet browser starts, which takes the user to the specified Internet page. To enable an Internet Address as a Click Area use the cell
type.
These are valid for the functions of Internet addresses:
Tree structure No No
Features
You are able to make the following settings for Internet addresses:
Get hyperlink objects
Create, change and delete hyperlink objects
Display Internet Address
Define Internet address as click area (assign cell type)
PUBLIC Page 61 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Methods
CL_SALV_HYPERLINKS GET
Methods
Use
You are able to define the content of a cell as a click area. When users click on this content, they trigger an event that you can handle as needed.
You are able to display icons in a column. If you later define the cells with the icons as click areas, the user then triggers the event by clicking
on the icon.
These are valid for the functions of click areas:
If users select a click area, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_HIERSEQ or
CL_SALV_EVENTS_TREE)
...
Features
You are able to make the following settings for click areas:
Display click area (assign cell and item type)
PUBLIC Page 62 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
1.6.3 Handling Single and Double Clicks
Use
Usually the user selects areas in the ALV output, by clicking - and perhaps also pressing CTRL or shift - in the ALV output.
You are also able to determine which functions will be started when the user performs the following mouse actions:
Single click on a cell or an item of the ALV output
Double click on a cell or an item of the ALV output
or alternatively
Selecting a cell or an item of the ALV output and pressing F2
Features
You are able to make the following settings for mouse actions:
Functions for single click
Functions for Double Click or F2
The following is valid for all of these functions:
The DOUBLE_CLICK event returns the position (cell or item) where the user double clicked. The second option, on the other hand, does not
return information about exactly where the double click occurred.
Methods
Use
Some keys on the keyboard have special meaning in ALV and you can assign specific functions to others:
F1 Function Key
The user calls a help text for the selected column using the F1 function key.
F2 Function Key
This key is always an alternative to double clicking. You determine which function is triggered when the user double clicks or presses F2. You cannot
change its meaning.
F4 function key
PUBLIC Page 63 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
With the F4 function key, users call a value list with possible entries that are possible and useful for their current situation.
Features
You are able to make the following settings for key settings:
Using an F1 Help Text for Another Data Element
Assigning any functions to keys
Hierarchical-sequential list No
By default, each key listed here is used for very specific purposes (for example, with the F4 function key, the user calls a dialog box with a
value list of the permitted or useful entries for the current column). Find out about the conventions in your company as to the meaning of the
individual keys. SAP recommends that you do not change the original objectives of the keys.
Methods
In the tree structure you are able to handle events for various keys and to define any functions for them in this way. The function keys F1 and
F4 are also available here. SAP recommends that you only use these keys for the help functions.
Use
Tooltips allow you to define short help texts for various elements of the ALV output:
By default the texts for tooltips are displayed for users when they move the mouse pointer over the column header and rest it there for a moment.
PUBLIC Page 64 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
For physically impaired users, especially blind or visually impaired ones, the tooltip texts are read aloud using screen reader technology.
You are able to define tooltips for the following elements of your ALV output:
For column headers
For functions in the application toolbar
For colors, exceptions and symbols
For elements in the design object
Depending on the element for which you want to define a tooltip, you proceed differently.
Features
You are able to make the following settings for tooltips:
Tooltip Object Management and Generation for Colors, Exceptions and Symbols
Generation of Tooltips for Column Headers
Generation of Tooltips for Functions
Generation of Tooltips for Icons and Symbols
Generation of Tooltips for Elements in the Design Object
Use
You are able to assign the tooltip objects to the following elements:
Symbols
Exceptions
Colors of cells
You use tooltip objects when the element to which the tooltip belongs can appear multiple times: to ensure that the same tooltip text is displayed every time,
when an element is displayed assign a specific tooltip object to the element.
The color green always means Released . In order to always display exactly this text as tool tip when a row is green, assign the appropriate
tooltip to the color.
The tooltip object contains the following information:
The type of tooltip object (that is for which element the tooltip can be sued)
The indicator for the element
The text that is displayed as tooltip
Features
You are able to make the following settings for tooltip objects:
Get tooltip object
Create, change and delete tooltip object
The following is valid for all of these functions:
Methods
CL_SALV_TREE GET_TREE_SETTINGS
CL_SALV_TREE_SETTINGS
CL_SALV_TOOLTIPS GET
PUBLIC Page 65 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Create, Change and Delete Tooltip Object
You are able to create any number of tooltip objects. You are able to delete tooltip objects either individually or all at once.
Methods
Use
You are able to display icons in the ALV output. To do this, you use a special indicator that uniquely identify the graphic file in your system.
You are able to define a tooltip for each icon individually. To do this, you add a separator and the text of the tooltip to the indicator. The following graphic
shows the structure of the indicator with a tooltip:
Use
You are able to store a help text for each element in the Data Dictionary (DDIC) independent of ALV. Wherever this DDIC element is used, the user is able to
call up this help text with the F1 function key.
In the tree structure, you are able to specify any function for the F1 function key. We strongly recommend that you use F1 help here.
You are able to specify a foreign DDIC element to a column without DDIC reference and then to use the F1 help text from it for your column.
Features
You are able to make the following settings for F1 help:
Use an F1 help text from another DDIC element
PUBLIC Page 66 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
Hierarchical-sequential list Yes
Methods
Get name of the DDIC element from which the F1 help GET_F1_ROLLNAME
text has been taken
Use
Users can print the ALV output on a printer or they can view the printout on the screen. You are able to change the look of these printouts by making various
settings in the list-type ALV outputs using the ALV object model.
For all of the following functions, this is valid:
Tree structure No No
Of course the user is also able to print a tree structure. However, you cannot make settings for the printout here with the ALV object model.
No matter which display type you use to display the ALV output on the screen: in the printout, the ALV output is converted to the classic ABAP list (or to a list
in the style of the ABAP list) and is printed in this form.
Features
You can make the following settings for the printout of the ALV output:
Output additional information
Output standard title of the program
Determine that the ALV be called in print mode
Take actual list size into consideration during printing
Optimize Column Width in the Printout
Reserve Rows for Event END_OF_PAGE
Methods
PUBLIC Page 67 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.
The standard title of the program comprises the current date, the title of the ALV output and the page number. You are able to show the standard title.
Methods
Methods
Methods
Take actual list size into consideration during printing CL_SALV_PRINT SET_PRINT_PARAMETERS_
ENABLED
PUBLIC Page 68 of 68
2014 SAP SE or an SAP affiliate company. All rights reserved.