You are on page 1of 99

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: Methods of Main ALV Classes to Get Subobjects Method GET_AGGREGATIONS GET_COLUMNS Returns Object of Type CL_SALV_AGGREGATIONS CL_SALV_COLUMNS_TABLE or CL_SALV_COLUMNS_HIERSEQ or CL_SALV_COLUMNS_TREE CL_SALV_DISPLAY_SETTINGS CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE CL_SALV_FILTERS CL_SALV_FUNCTIONAL_SETTINGS CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE CL_SALV_LAYOUT CL_SALV_HIERSEQ_LEVEL CL_SALV_NODES CL_SALV_PRINT CL_SALV_SELECTIONS CL_SALV_SELECTIONS_TREE CL_SALV_SORTS CL_SALV_TREE_SETTINGS Remarks

GET_DISPLAY_SETTINGS GET_EVENT

Not in CL_SALV_TREE

GET_FILTERS GET_FUNCTIONAL_SETTIN GS GET_FUNCTIONS GET_LAYOUT GET_LEVEL GET_NODES GET_PRINT GET_SELECTIONS GET_SORTS GET_TREE_SETTINGS

Not in CL_SALV_TREE Not in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE Only in CL_SALV_HIERSEQ_TABLE Only in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE

If one of the classes uses another class, you can also get its objects using the Get methods. Class Used CL_SALV_AGGREGATIONS CL_SALV_COLUMNS_TABLE CL_SALV_COLUMNS_HIERSEQ CL_SALV_COLUMNS_TREE CL_SALV _FUNCTIONAL_SETTINGS CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE CL_SALV_FILTERS CL_SALV_NODES CL_SALV_SORTS Includes Get method Returns Object of Type GET_AGGREGATION CL_SALV_AGGREGATION GET_COLUMN CL_SALV_COLUMN

GET_DROPDOWNS GET_HYPERLINKS GET_TOOLTIPS GET_FUNCTIONS GET_FILTER GET_NODE GET_SORTS

CL_SALV_DROPDOWNS CL_SALV_HYPERLINKS CL_SALV_TOOLTIPS CL_SALV_FUNCTION CL_SALV_FILTER CL_SALV_NODE CL_SALV_SORT

Title of the ALV Output


Methods Function Change wording of the title (simple, two-dimensional table and hierarchical-sequential list) Get current title Change wording of the title (tree structure) Get current title
Change Font Size of the Title

Class Method CL_SALV_DISPLAY_SETTINGS SET_LIST_HEADER

CL_SALV_TREE_SETTINGS

GET_LIST_HEADER SET_HEADER GET_HEADER

Methods Function Change Font Size of the Title Get current font size Class Method CL_SALV_DISPLAY_SETTINGS SET_LIST_HEADER_SIZE GET_LIST_HEADER_SIZE

Columns
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: y Standard columns y Lead columns, which are columns that have a special textual meaning in your ALV output. y 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.

y y y y y y y y

Set the visibility of the column Change Position of the Column within the ALV Output Change Column Header Columns with Special Meaning Lead Columns Setting the Properties of Text in the Column Determining Appearance Determining Width of a Column

Get Column Objects The GET_COLUMNS method exists in each ALV main class. It returns the column descriptions of all columns in the ALV output (all column objects). You use this object (class CL_SALV_COLUMNS) and the GET method or GET_COLUMN methods to get the desired column description.

Methods Function Get all column objects Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_COLUMNS GET CL_SALV_HIERSEQ_LEVEL GET_COLUMNS CL_SALV_COLUMNS CL_SALV_COLUMN CL_SALV_ITEM CL_SALV_AGGREGATION CL_SALV_SORT GET_COLUMN GET_COLUMNNAME Method GET_COLUMNS

Get all column objects for a hierarchy level Get specific column object Get technical name of the current column

Set the Visibility of the Column

For columns that you have defined as lead columns, you are able to determine whether the user can hide them or not. y 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 Function Set the visibility of a column Check setting for visibility Define column as technical column Check whether column is a technical column Class Method CL_SALV_COLUMN SET_VISIBLE IS_VISIBLE SET_TECHNICAL IS_TECHNICAL

Change Position of the Column within the ALV Output The exception column is always displayed as the first column. You cannot change its position.

Methods Function Change the position of a Class Method CL_SALV_COLUMNS SET_COLUMN_POSITION

column Get current position of a column

GET_COLUMN_POSITION

Change of DDIC Reference for a Column


You are also able to change description of column objects by creating or changing a DDIC reference. Here you have the following options: y You change the description of an individual column y 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. y Short, medium and long text of the column header y F1 help text If the typing also matches (internal type and internal length), the remaining properties are also transferred, such as y F4 help and search help y Data element and domain y Columns for amounts, currency, decimal places and rounding
Get information on the DDIC element You are able to get all sorts of information that results from the DDIC reference of a column:

Methods Function Get name of the DDIC data element Get DDIC data type Get DDIC decimal places Get DDIC domains Get output length according to DDIC (CHAR) Class Method CL_SALV_COLUMN GET_DDIC_ROLLNAME GET_DDIC_DATATYPE GET_DDIC_DECIMALS GET_DDIC_DOMAIN GET_DDIC_OUTPUTLEN

If a column does not have a DDIC reference, you are able to retrieve the following properties:
y y  Internal length To do this, use the method GET_DDIC_INTLEN  Internal type To do this, use the method GET_DDIC_INTTYPE

Change DDIC Reference of an Individual Column or of Multiple Columns You are able to create or change the DDIC reference for one or more columns. If multiple columns of your ALV output have the same name as the fields in a DDIC structure that already exists, you assign the entire DDIC structure to your ALV output. Columns with the same name get the properties of the corresponding fields of the DDIC structure.

Methods Function Change DDIC reference for an individual column Get DDIC reference for the column Change DDIC reference for several columns Class CL_SALV_COLUMN Method SET_DDIC_REFERENCE GET_DDIC_REFERENCE CL_SALV_COLUMNS APPLY_DDIC_STRUCTURE

Column Header
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:

y Determine wording of the column header y Display or hide column header y Determine whether the user can sort the table according to this column by clicking on the column header y Determine tooltip for the column header y Display an icon (only tree structure)
Determine Wording of the Column Header You can specify three different variants of the column header: The long, medium and short column header. If the user changes the column width, the column header that fits the column best is automatically used. 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 Function Determine version of the column header Class CL_SALV_COLUMN Method SET_LONG_TEXT SET_MEDIUM_TEXT SET_SHORT_TEXT GET_LONG_TEXT GET_MEDIUM_TEXT GET_SHORT_TEXT Determine column CL_SALV_TREE_SETTINGS SET_HIERARCHY_HEADER header of the hierarchy column of a tree structure Get column header of GET_HIERARCHY_HEADER the hierarchy column of a tree structure
Display or Hide Column Header

Get current column header

Methods Function Display or hide column header Check whether column headers are being displayed or hidden

Class Method CL_SALV_COLUMNS_LIST SET_HEADERS_VISIBLE IS_HEADERS_VISIBLE

Sort by Clicking on Column Header You are able to determine that the column header serve as a pushbutton for sorting the table. The sort direction is then indicated as a small arrow pointing up or down.

Methods Function Set column header as pushbutton for sorting the table Check whether column header is set as pushbutton for sorting the table Class Method CL_SALV_ SET_SORT_ON_ FUNCTIONAL_SETTINGS HEADER_CLICK IS_SORT_ON_ HEADER_CLICK

Determine Tooltip for the Column Header You are able to define a text that will be displayed when the user rests the mouse pointer on the column header for a moment. 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 Function Determine tooltip for the column header Get current tooltip for a column header Set tooltip for hierarchy column of a tree structure Get tooltip for hierarchy column of a tree structure Get all tooltip objects for column headers of the tree structure
Display Icon In the column header of the hierarchy column for a tree structure, you can display an icon.

Class Method CL_SALV_COLUMN SET_TOOLTIP GET_TOOLTIP CL_SALV_ TREE_SETTINGS SET_HIERARCHY_TOOLTIP GET_HIERARCHY_TOOLTIP GET_TOOLTIPS

Methods Function Display icon in the column header of the hierarchy column ?? Get icon currently being displayed Class Method CL_SALV_ SET_HIERARCHY_ICON TREE_SETTINGS GET_HIERARCHY_ICON

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:

y Lead columns have a different color. This color is determined by the system. y 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. y 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.
Use You are able to make the following settings for lead columns:

y y y y

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

Defining the Column as a Lead Column You are able to define any column of the ALV output as a lead column.

Methods
Function Class Method

Define lead columns Check whether a column is a lead column


Defining a Color in a Lead Column

CL_SALV_COLUMN_LIST SET_KEY IS_KEY

Lead columns have their own background color that helps you to differentiate between them and the regular columns in your ALV output. This color is determined by the system. You are not able to change the color of the whole column. However, you are able to override the predefined background color for individual cells of the lead column: You define a separate color column, where you specify one of the possible alternative colors for the desired cell. You also use the NOKEYCOL field in the color column to explicitly deactivate the system color.

Methods
Function Class Method

Define color column Get color column

CL_SALV_COLUMNS_LIST SET_COLOR_COLUMN GET_COLOR_COLUMN

Prevent Lead Columns from Scrolling If there is not enough room for all of the columns of the ALV output to be displayed on the screen simultaneously, the user can scroll sideways until the desired column becomes visible. Usually the other columns disappear when you are doing this. You are able to determine whether the lead columns are fixed, which means that they remain visible when you scroll sideways.

Methods
Function Class Method

Fix lead columns Checks whether the lead columns are fixed

CL_SALV_COLUMNS_LIST SET_KEY_FIXATION HAS_KEY_FIXATION

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
Function Class Method

Prevent lead columns from being hidden Check whether the lead column can be hidden

CL_SALV_COLUMN_LIST SET_KEY_PRESENCE_REQUIRED IS_KEY_PRESENCE_REQUIRED

Columns with Special Technical Meaning


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:
y y 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:
y y y Use Depending on how you use a special column, you need to be aware of different things. Using Control Columns With control columns you assign specific properties to one or more cells. 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

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

Control Columns That are Assigned to a Specific Column

Specifications in the control column exclusively refer to the current column. The cells of this control column each can only contain one value that controls the content of the linked cell.

For this type of control columns, use the following methods:

Control column Currency column Column for decimal places Column for units of measure Rounding column

Class Method CL_SALV_COLUMN SET_CURRENCY_COLUMN GET_CURRENCY_COLUMN SET_DECIMALS_COLUMN GET_DECIMALS_COLUMN SET_QUANTITY_COLUMN GET_QUANTITY_COLUMN SET_ROUND_COLUMN GET_ROUND_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. Control Columns That Contain Information for Any Number of Columns

The cells of this control column contain whole tables: Each of these tables exclusively refers to cells in the same row of the ALV output. If this table contains multiple rows, each of these rows controls a specific column of the ALV output. Every row then contains the name of the column in the ALV output to which the settings refer (in the graphic below, rows 1 and 2). If no column name is specified, all columns of the ALV output get the settings (in the graphic below, row 3).

For this type of control columns, use the following methods: Control column Column for cell types Color column Hyperlink column Class Method CL_SALV_COLUMNS_LIST SET_CELL_TYPE_COLUMN GET_CELL_TYPE_COLUMN SET_COLOR_COLUMN GET_COLOR_COLUMN SET_HYPERLINK_ENTRY_ COLUMN GET_HYPERLINK_ENTRY_ COLUMN SET_DROPDOWN_ENTRY_ COLUMN GET_DROPDOWN_ENTRY_ COLUMN

Dropdown column

In the tree structure you are able to assign colors to nodes or to an individual item. 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.

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 Function Defining the column as a icon column Check whether the current column is an icon column Define the column as a symbol column Check whether the current column is an symbol column
Exception Column

Class Method CL_SALV_COLUMN_LIST SET_ICON IS_ICON SET_SYMBOL IS_SYMBOL

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, 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 Function Specify exception column Get exception group Class CL_SALV_COLUMNS_LIST Method SET_EXCEPTION_COLUMN the

CL_SALV_COLUMNS_TREE GET_EXCEPTION_COLUMN 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, twodimensional table or hierarchical-sequential list. The following table shows where you can use which exception group. Exception Group Icon Representation Classic ABAP List Yes No No No No No No Full screen Containers Hierarch.Seq. List Yes No No No No No No

1 2 3 4 5 6 7

LIGHTS LED STATUS TREND MESSAGE ALERT FAILURE/INCOMPLETE/ CHECKED

Yes No No No No No No

Yes Yes Yes Yes Yes Yes Yes

Columns with Special Function With some special columns, you control functions that are only useful in very specific situations.
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.

Methods Function Define expansion column Get current expansion column Class Method CL_SALV_COLUMNS_HIERSEQ SET_EXPAND_COLUMN GET_EXPAND_COLUMN

Text Column for Labels in Results Rows for Intermediate Results

You are able to display intermediate results for aggregations. These intermediate results are displayed in a special results row in the column the values of which are used in the aggregation. All other columns in this row are empty by default. You are able to specify a column the values of which are also transferred to the results row.

Methods Function Define text column Get current text column Class Method CL_SALV_COLUMN_LIST SET_TEXT_COLUMN GET_TEXT_COLUMN

Counter Column to Determine the Number of Rows

You are able to determine and output the number of data records of the ALV output. To do this, you need a special column, the count column. The rows of this count column never display data. The results row, however, contains the number of data records. Methods Function Define count column Get count column Class Method CL_SALV_COLUMNS_LIST SET_COUNT_COLUMN GET_COUNT_COLUMN

Header and Footer Areas of the ALV Output


Use You are able to make the following settings for design objects:

y y y

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

Design Object Compilation


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.

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:

Classes of Element Types and Layouts Layout Row-type layout Table-type layout Class CL_SALV_FORM_LAYOUT_FLOW CL_SALV_FORM_LAYOUT_GRID

Element Type Action Info Header Info Label Text

Class CL_SALV_FORM_ACTION_INFO CL_SALV_FORM_HEADER_INFO CL_SALV_FORM_LABEL 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 Function Generate an element of the desired type Move element Count elements Class Method CL_SALV_FORM_LAYOUT_ CREATE_* FLOW CL_SALV_FORM_LAYOUT_ SET_ELEMENT GRID GET_ELEMENT_COUNT

Link cells

Show lines between columns and rows Get number of columns and rows Specify which column contains the labels and which column contains the associated texts Add rows
Element Types

CL_SALV_FORM_LAYOUT_ CREATE_* GRID SET_ELEMENT (Parameter COLSPAN or ROWSPAN) SET_GRID_LINES

GET_COLUMN_COUNT GET_ROW_COUNT SET_COLUMN_LABEL_FOR

ADD_ROW

You have similar functions available for the element types:

Methods Function Enter text Enter tooltip Specify alignment within a cell Class CL_SALV_FORM_ACTION_INFO Method SET_TEXT SET_TOOLTIP CL_SALV_FORM_HEADER_INFO SET_HORIZONTAL_ ALIGNMENT CL_SALV_FORM_LABEL GET_HORIZONTAL_ CL_SALV_FORM_TEXT ALIGNMENT CL_SALV_FORM_LABEL SET_LABEL_FOR GET_LABEL_FOR

Specify the text element to which the label belongs


Example

The following example shows how you display an element of type Text at the end of the ALV output: ... *... END_OF_LIST

data: lr_text type ref to cl_salv_form_text.

create object lr_text 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 data: lr_text type ref to cl_salv_form_text. data: lr_label type ref to cl_salv_form_label. data: lr_grid type ref to cl_salv_layout_grid,

create object lr_grid. lr_label = lr_grid->create_label( text = '1.1 LABEL' row = 1 column = 1 ). lr_text = lr_grid->create_text( text = '1.2 TEXT' row = 1 column = 2 ). lr_label->set_label_for( lr_text ).

lr_text = lr_grid->create_text( text = '2.2 TEXT' row = 2 column = 2 ). gr_table->set_top_of_list( lr_grid ). ...

Display List Header and Footer


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.
Choosing the Output Medium

If you want to design the list header or footer, you need to decide on the output medium for which you want to use your design object.

For display on a screen (online) On a printout (print)


Depending on which output medium you choose, the design object has a different appearance.

If you only insert a design object for display on the screen, it appears both on the screen and on the printout. If you insert a design object for display on the screen and another one for the printout, one appears on the screen and the other appears on the printout. If you only insert a design object for the printout, the design object only appears on the printout.
If Top of List Does Not Fit on One Page

As with all other design objects, the Top of List design object is limited to one page in length, which is predefined by the print format. You can however specify for the ALV output that Top of List can be longer than one page. This setting has the following effects:

On the screen output, the column titles of the ALV output are no longer frozen. When the user scrolls vertically, the column titles also roll with the list. You can choose the order in which the design objects for Top of List and Top of Page are arranged. Methods Function Allow Top of List with more than maximum permitted number of lines Class CL_SALV_TABLE Method SET_MODUS

CL_SALV_HIERSEQ_TABLE with the following constants: Sequencing: CL_SALV_FORM_CONTENT=> Top of List, Top of Page Sequencing: Top of Page, Top of List C_MODUS_EXCEED_TOL_TOP CL_SALV_FORM_CONTENT=> 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.
What Goes Where?

You are not able to insert all variants of the design object in every ALV tool and in every display type. The following tables show which functions are possible in which environments:
Methods

To display the design object on the screen or on the printout, use the following methods: Function Before output, on screen Class CL_SALV_TABLE Method SET_TOP_OF_LIST

After output, on screen

CL_SALV_HIERSEQ_TABLE GET_TOP_OF_LIST SET_END_OF_LIST CL_SALV_TREE GET_END_OF_LIST

Before output, on printout

SET_TOP_OF_LIST_PRINT GET_TOP_OF_LIST_PRINT SET_END_OF_LIST_PRINT GET_END_OF_LIST_PRINT

After output, on printout

Displaying Page Headers and Footers


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

y 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.

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

y 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. y 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. y 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.

Special Functions of the Hierarchical-Sequential List


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.

In the hierarchical-sequential list, you are able to use the following special functions.

y y

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 Linking Data Tables for the Header and Position Level You are able to link the two internal data tables of the hierarchical-sequential list with up to five foreignkey relationships.

Methods Function Link data tables Class Method CL_SALV_HIERSEQ_ FACTORY TABLE (Parameter T_BINDING_LEVEL1_LEVEL2) SET_DATA (Parameter T_BINDING) CL_SALV_HIERSEQ_ GET_BINDING LEVEL

Get foreign key relationships

Displaying or Hiding Position Rows By default, users cannot hide the position rows of a hierarchical-sequential list: there are no symbols to enable this function. You are able to define a column from the header level as an expansion column. This has the following effects:

y You are able to hide or display the position rows of a specific header row using the contents of this expansion column. y A symbol is displayed in each header row that the user can click to manually hide or display the associated position rows. y You are able to hide or display the position rows for all header rows simultaneously with your application. Methods

Function Define a column on the header level as expansion column Get current expansion column Hide position rows for all header rows Get current status of position rows

Class Method CL_SALV_COLUMNS_ SET_EXPAND_COLUMN HIERSEQ GET_EXPAND_COLUMN CL_SALV_HIERSEQ_ LEVEL SET_ITEMS_EXPANDED IS_ITEMS_EXPANDED

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. y 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. y 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. y 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:

y Determining Column Header (Section: Determining Wording of the Column Header) y Inserting Icons into the Column Header (Section: Display Icon) y Determining the Tooltip for the Column Header (Section: Determining the Tooltip for the Column Header) y Define text for the node y Determine icons for expanded and collapsed branches y Display leaf as branch
You are able to make the following settings for nodes:

y y y

Get node objects Generate, move and delete nodes Collapse and expand branches

You are able to make the following settings for items:

y y y

Determine value Set Display of the Item Set selectability

Features For all of the following functions, this is valid:

Display type ALV Tool Simple, two-dimensional table

Classic ABAP list No

Full screen No

In the Container No

Hierarchical-sequential list Tree structure


Get Node Object

No Yes Yes

Each node is represented by an object of class CL_SALV_NODE, and all of the nodes together are represented by the object CL_SALV_NODES. You get the references to the desired node object using various getter methods:

Function All nodes together List of all node objects and their key Specific key Top node List of all subnodes and their key Get key for the node Related nodes

Class Method CL_SALV_TREE GET_NODES CL_SALV_NODES GET_ALL_NODES GET_NODE GET_TOP_NODE GET_SUBTREE GET_CHILDREN GET_KEY GET_PARENT GET_FIRST_CHILD GET_LAST_CHILD GET_PREVIOUS_SIBLING GET_NEXT_SIBLING

CL_SALV_NODE

Generate, Move and Delete Nodes While you can display whole tables with one command using the ALV tools: simple, two-dimensional table and a hierarchical-sequential list, with the tree structure, you need to generate the nodes individually. To do this, provide at least the following:

y The contents of the node that you wish to insert. The new node must have exactly the same structure as is specified in the initial table. y One reference node Every node is uniquely identified by a key. If there is not yet a node in the tree structure, there will still be the top node. By default, the top node has an empty character string as the key. You insert the new node at a position relative to the reference node.

y The relationship between the new node and the reference node You are able to insert the new node at one of the following positions relative to the reference node:

Methods Function Add nodes Change top node Move node to another position within the tree structure Delete node with all of its subnodes Delete all nodes of the tree structure
Determine Text in the Hierarchy Column The hierarchy column is not part of the initial table. This means you are not able to control text in it with the contents of the data table. You determine the texts in the hierarchy column for each node individually.

Class Method CL_SALV_NODES ADD_NODE SET_TOP_NODE CL_SALV_NODE MOVE DELETE CL_SALV_NODES DELETE_ALL

Methods Function Determine text in the hierarchy column Get current text in the hierarchy column Class Method CL_SALV_NODE SET_TEXT GET_TEXT

Determine Icons for Expanded and Collapsed Branches By default, a node that contains subnodes is indicated by an icon that looks like a folder. The icon looks different depending on whether the node is expanded or collapsed. You are able to use a different graphic for each icon. You determine both icons for each icon individually.

Methods Function Set icon for expanded branch Set icon for collapsed branch Get icon for expanded branch Get icon for collapsed branch
Display Leaf as Branch For reasons of speed, you are able to display a node as a branch even if it does not contain subnodes. When the user expands the node, you insert the subnodes.

Class Method CL_SALV_NODE SET_EXPANDED_ICON SET_COLLAPSED_ICON GET_EXPANDED_ICON GET_COLLAPSED_ICON

A node that is displayed as a branch although it contains no subnodes is also called an empty folder. Methods Function Instead of displaying the icon for leaves, show the icon for a collapsed branch Check whether the node is an empty folder Display an expander in the empty folder Check whether the empty folder has an expander Class Method CL_SALV_NODE SET_FOLDER

IS_FOLDER SET_EXPANDER HAS_EXPANDER

When the user expands an empty folder, the event EXPAND_EMPTY_FOLDER from the class CL_SALV_EVENTS_TREE is triggered.
Expand or Collapse Branches or Hide Areas You are able to expand and collapse the branches of the tree structure individually or together. Beyond that you are able to make a node or an item completely invisible.

Methods Function Expand individual branch Class CL_SALV_NODE Method EXPAND

Collapse individual branch Expand all branches Collapse all branches Change visibility of a node Check whether the node is visible Change visibility of an item Check whether the item is visible

COLLAPSE CL_SALV_NODES EXPAND_ALL COLLAPSE_ALL CL_SALV_NODE SET_VISIBLE IS_VISIBLE CL_SALV_ITEM SET_VISIBLE IS_VISIBLE

Change the Content of a Node or an Item While you are modifying the contents of the two ALV tools simple, two-dimensional table and hierarchical-sequential list by making changes to the transferred table, changes also take place in the tree structure on the node or item level.

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 Function Change content of a node Get content of a node Change contents of an item Get content of an item
Set Display of the Item In items of the tree structure you are able to display things other than text. With the type of the item, you are able to determine that one of the following elements be displayed in it:

Class Method CL_SALV_NODE SET_DATA_ROW GET_DATA_ROW CL_SALV_ITEM SET_VALUE GET_VALUE

y y y y y y

Default Text Checkbox Pushbutton Link Icon

For the types Checkbox (CHECKBOX), Pushbutton (BUTTON) and Link (LINK), there are events available to process interactions by the user.

The user can only change the value of checkboxes that are enabled. Methods

Function Set type of an item Get current type of the item Change value of a checkbox Check value of a checkbox Enable checkbox so that the user can change the value interactively Check whether a checkbox is enabled Insert icon Get icon

Class Method CL_SALV_ITEM SET_TYPE GET_TYPE SET_CHECKED IS_CHECKED SET_EDITABLE IS_EDITABLE SET_ICON GET_ICON

To display an icon in an item, proceed as follows:


y y y y y You assign the type Default (DEFAULT) to the item  You ensure that the content of the item is a permitted indicator for the desired icon (for example @AB@)  Use the method SET_ICON in the CL_SALV_ITEM class.  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.


Set Selectability of an Item By default, the user is able to select an item by clicking on it or by pressing the tab key. You are able to determine that users cannot select an item.

Methods Function Set selectability of an item Check selectability Class Method CL_SALV_ITEM SET_ENABLED IS_ENABLED

Basic ALV Functions


y y y y y Sort Filter Perform Aggregations Enable Layouts Selection

Sorting by Columns
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:

y y y y y y

Get sort objects Create and delete sort objects Set sort direction Set column sequence of sorting Forbid changes Highlight control level change

Get Sort Objects In every main ALV class where sorting is possible, the GET_SORTS method exists. This method returns the sort objects for all columns in the ALV output (class CL_SALV_SORTS). Using this object with the methods GET or GET_SORT you get the sort object for the desired column.

Methods
Function Get SORTS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_SORTS CL_SALV_HIERSEQ_LEVEL Method GET_SORTS

Get all sort objects Get all sort

GET GET_SORTS

objects for a hierarchy level Get a specific sort object Check whether a column is sorted (a sort object exists) Create and Delete Sort Objects You are able to create a maximum of one sort object for a column You are able to sort the ALV output using up to nine columns. You are able to delete sort objects either individually or all at once. CL_SALV_SORTS GET_SORT IS_SORT_DEFINED

Methods
Function Create sort object Delete individual sort object Delete all sort objects Class CL_SALV_SORTS Method ADD_SORT REMOVE_SORT CLEAR

If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Set Sort Direction For each individual sort object, you are able to determine whether you want to sort the column ascending (for example a, b, c) or descending (for example c, b, a): You set the sort direction.

Methods
Function Set sort Direction Get sort direction Class CL_SALV_SORTS CL_SALV_SORT CL_SALV_SORT Method ADD_SORT (Parameter SEQUENCE) SET_SEQUENCE GET_SEQUENCE

Set Column Sequence of Sorting If you sort the ALV output by multiple columns, the result changes depending on the sequence of columns that is used to sort.

By default, the columns are sorted in the sequence in which you generated your sort objects. You are able to change this sequence.

Methods
Function Change column sequence of sorting Forbid Changes By default, the user can change sort settings that you have specified using the application. However, you are able to expressly forbid this. Class CL_SALV_SORTS Method ADD_SORT (Parameter POSITION) SET_POSITION

Methods
Function Forbid changes to sort object Class CL_SALV_SORTS CL_SALV_SORT CL_SALV_SORT Method ADD_SORT (Parameter OBLIGATORY) SET_OBLIGATORY IS_OBLIGATORY

Check whether user is able to make changes to the sort object Highlight Control Level Change

If a value changes in a sorted column between two data records, this is called a control level change. You are able to highlight the control level change in two ways:

y y

You separate the group levels with a horizontal line. You start a new page for each control level.

Prerequisite

You have activated grouping of the ALV output.

Methods
Function Activate grouping of the ALV output Check whether grouping of the ALV output has been activated. Set display of control level change Class CL_SALV_SORTS Method SET_GROUP_ACTIVE IS_GROUP_ACTIVE ADD_SORT (Parameter

CL_SALV_SORT Get display of the control level change

GROUP) SET_GROUP GET_GROUP

Filter Data Rows


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

y The comparison value with which the rows are tested. This can be an individual value or an range for the given value. y 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) y 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' ). ...     With the columname parameter, you determine the column name With the low (or high) parameter, you determine the comparison value With the option parameter, you determine the condition With the sign parameter, you determine whether it is an inclusive or exclusive condition

Features You are able to make the following settings for aggregations:

y y y

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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes No

In the Container Yes No

Get Filter Objects and Filter Conditions The GET_FILTERS method exists in each ALV main class in which filtering is possible. It returns the FILTERS object of the ALV output (all filter objects for the column). Using this FILTERS object with the methods GET or GET_FILTER, you get the filter object for the desired column, as long as one exists there. You also get the filter conditions using the filter object.

Methods

Function Get FILTERS object

Class CL_SALV_TABLE

Method GET_FILTERS

Get all filter objects Get all filter objects for a hierarchy level Get specific filter object Check whether a column is filtered (a filter object exists) Get all filter conditions for a filter object

CL_SALV_HIERSEQ_TABLE CL_SALV_FILTERS GET CL_SALV_HIERSEQ_LEVEL GET_FILTERS CL_SALV_FILTERS GET_FILTER IS_FILTER_DEFINED

CL_SALV_FILTER

GET

Generate and Delete a Filter Object and Filter Condition You are able to create a maximum of one filter object for a column. However, you are able to create any number of filter conditions for each filter object. You are able to delete filter objects either individually or all at once. The filter conditions for a filter object can only be deleted all at once.

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).
Defining a Filter Condition

When you define the first filter object for a column a filter condition is automatically generated. You make the settings for this using the parameters for the method ADD_FILTER. You create all further filter conditions for the same column using the ADD_SELOPT method. You manage all information for the filter conditions using the methods of class CL_SALV_SELOPT.

Methods Function Generate filter object Delete individual filter object Delete all filter objects Generate filter condition Delete all filter conditions Determine comparison value or area Class Method CL_SALV_FILTERS ADD_FILTER REMOVE_FILTER CLEAR ADD_SELOPT CLEAR SET_LOW SET_HIGH

CL_SALV_FILTER CL_SALV_SELOPT

Get comparison value

GET_LOW GET_HIGH SET_OPTION GET_OPTION SET_SIGN GET_SIGN

Define condition (operator) Get condition (operator) Determine inclusion or exclusion Get inclusion or exclusion

If you assign a new data table with a new structure to your ALV output, all filter objects will be deleted automatically.
Forbid Filters for a Column By default you or the user is able to define a filter for every column. For each column you can determine whether a filter object can be defined for it.

Methods Function Forbid filters for a column Check whether filters are forbidden for a column Class Method CL_SALV_FILTERS SET_FILTER_ALLOWED IS_FILTER_ALLOWED

Making Calculations (Aggregation)


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:

y y y

General Settings for the Aggregation Object Settings for the Results Rows Settings for Intermediate Results

Make Settings for Aggregation


Use You are able to make various settings for the calculation of columns. The following types of calculation are available:

y Total Adds all values for the column y Minimum Determines the smallest value for the column y Maximum Determines the largest value for the column y 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:

y y y y y y

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: Display type Classic ABAP list Yes Yes Full screen Yes Yes In the Container Yes Yes

ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure


Getting Aggregation Object

The GET_AGGREGATIONS method, which returns all aggregation objects of the ALV output (class CL_SALV_AGGREGATIONS), exists in every main ALV class. Using this object with the methods GET or GET_AGGREGATION, you get the aggregation object for the desired column.

Methods Function Get AGGREGATIONS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_HIERSEQ_LEVEL GET_AGGREGATIONS CL_SALV_AGGREGATIONS GET GET_AGGREGATION IS_AGGREGATION_ DEFINED Method GET_AGGREGATIONS

Get AGGREGATIONS object for a hierarchy level Get all aggregation objects Get a specific aggregation object Check whether a column will be calculated (has an aggregation object)

Creating and Deleting Aggregation Object You are able to create a maximum of one aggregation object for a column You are able to delete aggregation objects either individually or all at once. You can also delete the settings for an aggregation object without deleting the aggregation object itself.

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 Function Class Create an CL_SALV_AGGREGATIONS aggregation object Delete individual aggregation object Delete all aggregation objects Delete aggregation CL_SALV_AGGREGATION settings for an aggregation object Method ADD_AGGREGATION REMOVE_AGGREGATION CLEAR CLEAR

If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Specifying the Type of Aggregation For an aggregation object, you specify - in addition to the column name - which type of calculation you wish to make with it: you set the type of aggregation object.

Methods Function Set aggregation type Class Method CL_SALV_AGGREGATIONS ADD_AGGREGATION (Parameter AGGREGATION) CL_SALV_AGGREGATION SET CL_SALV_AGGREGATION GET

Get aggregation type

Allow and Forbid Aggregation By default, all columns with a numeric data type can be aggregated with the exception of columns of data type NUMC.

You are able to set whether a column can be aggregated as follows:

y y

In columns that actually have a suitable data type, forbid aggregation In columns of data type numeric text, you expressly allow aggregation

Methods Function Forbid aggregation in suitable columns Check whether aggregation is allowed in suitable columns Allow aggregation in numeric text Check whether aggregation is allowed in numeric text Class Method CL_SALV_AGGREGATIONS SET_AGGREGATION_ ALLOWED IS_AGGREGATION_ ALLOWED SET_NUMERICAL_ AGGREGATION IS_NUMERICAL_ AGGREGATION_ON

Results Rows
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

y Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions) y Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)

Determining the Position of the Results Row You are able to define whether you wish to display the results row for the calculations in an ALV output above or below the rows that are included in the calculation.

Methods Function Class Determining the position CL_SALV_AGGREGATIONS of the results row Check where the results rows are located Method SET_AGGREGATION_ BEFORE_ITEMS IS_AGGREGATION_ BEFORE_ITEMS

Generating Intermediate Results


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:

y 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. y 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. y 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.

y The column with the criterion for intermediate results is a column that cannot be aggregated. y You are able to generate intermediate results for up to nine columns.

Features You are able to make the following settings for intermediate results:

y y y

Generating Intermediate Results Hide Subvalues of Intermediate Results Determining the Position of the Results Row

y Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions) y 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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Generating Intermediate Results

Classic ABAP list Yes Yes

Full screen Yes No

In the Container Yes No

To display intermediate results in a column that already has an aggregation object, use the sort object from another column.

The column that contains the sort object has to have one of the following data types:
y  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
Function Class Method

Generating intermediate results

Check whether intermediate results are generated for a specific column

CL_SALV_SORTS ADD_SORT (Parameter SUBTOTAL) CL_SALV_SORT SET_SUBTOTAL CL_SALV_SORT IS_SUBTOTALLED

Hide Subvalues of Intermediate Results You are able to hide the data records that form the subvalues of an intermediate result. To do this, specify the column that contains the criteria for the intermediate results, not the column that contains the calculated values.

Methods
Function Class Method

Hide subvalues of CL_SALV_SORTS SET_COMPRESSED_SUBTOTAL intermediate results Get column that only GET_COMPRESSED_SUBTOTAL displays results rows Check whether the CL_SALV_SORT IS_SUBTOTAL_COMPRESSED rows for an intermediate result are hidden or displayed

Settings Management in Layouts


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 Layout in Contrast to Layout for All Users

Layouts can be available to only one user or for all users of your application. Depending on that, the layout is designated as either a user-specific layout or a layout for all users. You are able to determine whether users are allowed to save user-specific layouts or whether they are authorized to save layouts for all users as well.

User-specific layouts and layouts for all users also differ in their names:
y y y    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:

y y y y y

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: Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential Classic ABAP list Yes Yes Full screen In the Container Yes

Yes

list Tree structure Get Layouts

Yes

Yes

You are able to get the settings for layouts that users have saved for your application.

Methods
Function Get layout object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE Get settings for individual layouts Get current layout Set Layout Key The layout key is a prerequisite for users are able to save a layout to your application. The layout key includes the following information: CL_SALV_LAYOUT GET_LAYOUTS GET_CURRENT_LAYOUT Method GET_LAYOUT

y y

Name of the application A key that uniquely identifies the output table within your application

y A logical group for further specification (for example with multiple ALV instances in one program) Methods
Function Set layout key Get layout key Class CL_SALV_LAYOUT Method SET_KEY GET_KEY

Determine for Whom Users Can Save Layouts By default, users are not able to save layouts. You are able to determine whether users can save layouts

y y

Only for themselves (user-specific) Only for other users (for all users)

For both themselves and for other users

Methods Function Determine for whom users can save layouts Check for whom users can save layouts Change Layout for Start of the ALV Output You have to ways of changing which layout will be used when the ALV output is started: Class CL_SALV_LAYOUT Method SET_SAVE_RESTRICTION GET_SAVE_RESTRICTION

y You allow the user to set one of the layouts as default. Depending on whether users choose a user-specific layout or one that is available to all users, the default is only valid for the user himself or for all users of the application. y You define a layout as initial layout. In this way, you override any defaults set up by the user. Methods
Function Allow defaults Get layout that was set by a user as a default Checks whether the user has set a layout as default Set initial layout Get initial layout Display Dialog Box for Layout You are able to display a dialog box that provides the user with a selection of layouts that are saved for your application. Class CL_SALV_LAYOUT Method SET_DEFAULT GET_DEFAULT_LAYOUT HAS_DEFAULT SET_INITIAL_LAYOUT GET_INITIAL_LAYOUT

Methods
Function Display dialog box Class CL_SALV_LAYOUT Method F4_LAYOUTS

Selecting Cells, Rows and Columns


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:

y y y y

Get settings for selection and information on the selected areas Set selection type Enable selection of nodes and items Select area

Get Information on Selections The method GET_SELECTIONS that returns the selection object exists in each main ALV class. With this object, you get the desired information with various getter methods.

Methods
Function Get selection object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_HIERSEQ_LEVEL Method GET_SELECTIONS

Get a selection object for a hierarchy level

GET_SELECTIONS

Set Selection Type With the selection type, you set which cells users are able to select simultaneously, that is, whether and how they can combine the selections. The selection type has different effects in the various display types. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure The following selection types are available: Classic ABAP list Yes Yes No No Full screen In the Container Yes

Yes

y y y y y

NONE SINGLE MULTIPLE ROW_COLUMN CELL

The following table shows which selection type you have to assign to the ALV output to enable users to execute the desired function.

Required Selection Type


Desired Function Select individual column Select individual row Select individual cell Select multiple cells (with CTRL or shift key) Select one or multiple rows and one or more columns (with CTRL key) Classic ABAP List Hier.-Seq. List NONE SINGLE NONE Not possible SINGLE Full screen Container NONE NONE CELL CELL MULTIPLE

ROW_COLUMN CELL ROW_COLUMN CELL

Provide pushbutton or checkbox to select rows

SINGLE

Methods
Function Set Selection Type Get selection type Enable Selection of Nodes and Items In the tree structure, you can determine whether the user is allowed to select individual nodes or items. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP list No No Yes Yes Full screen In the Container No Class CL_SALV_SELECTIONS Method SET_SELECTION_MODE GET_SELECTION_MODE

No

Methods
Function Set selectability of the item Check whether the item can be selected Markierbarkeit des Knotens festlegen Check whether the node can be selected Select Area You are able to set selections in the ALV output using your application. Class CL_SALV_ITEM Method SET_ENABLED IS_ENABLED CL_SALV_NODE SET_ENABLED IS_ENABLED

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen

In the Container Yes

Yes

Yes

Yes

Methods
Function Set current cell Get current cell Select cells Get selected cells Select rows Get selected rows Select columns Get selected columns Select node Get selected nodes Select item Get selected item Class CL_SALV_SELECTIONS Method SET_CURRENT_CELL GET_CURRENT_CELL SET_SELECTED_CELLS GET_SELECTED_CELLS SET_SELECTED_ROWS GET_SELECTED_ROWS SET_SELECTED_COLUMNS GET_SELECTED_COLUMNS SET_SELECTED_NODES GET_SELECTED_NODES SET_SELECTED_ITEM GET_SELECTED_ITEM

CL_SALV_SELECTIONS CL_SALV_SELECTIONS_TREE CL_SALV_SELECTIONS_TREE

Determining the Appearance of the ALV Output


You can change the appearance of the ALV output in various ways. The options are mainly restricted by the Display Type in which you are displaying the ALV output.

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:

y y

Defining Colors for Columns, Rows and Cells Setting Text Properties

y y y y y

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

Color Definition for Columns, Rows and Cells


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.
Text Color, Background Color, Intensity and Inverse Display

The various ALV tools use different concepts when dealing with color:

In the tree structure, some fixed combinations of text and background color are available. Colors in the Tree Structure Text Color Black Black Black Black Black Black Black Gray Dark Blue Dark Red Background Color Standard Light yellow Medium blue Light blue Salmon colored Red Green Standard Standard Standard Technical Name DEFAULT EMPHASIZED EMPHASIZED_A EMPHASIZED_B EMPHASIZED_C EMPHASIZED_NEGATIVE EMPHASIZED_POSITIVE INACTIVE INTENSIFIED INTENSIFIED_CRITICAL

In both of the other tools you are able to change the combinations of text and background color to a certain degree:
y You choose a color from a set of possible colors.

y y

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)

Colors in List-Type ALV Outputs Color GUIDependent Gray Blue Light Gray Yellow Blue Green Green Red orange Technical Name COL_BACKGROUND COL_HEADING COL_NORMAL COL_TOTAL COL_KEY COL_POSITIVE COL_NEGATIVE 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.
Changing the Color of Columns The color is a property of the column. You can change them directly this way.

You are only able to change the color of a column if it is not a lead column. Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Classic ABAP List Yes Yes Full Screen Yes In the Container Yes

Tree structure Methods Function Changing the Color of Columns Get the color of a column

No

No

Class Method CL_SALV_COLUMN_LIST SET_COLOR GET_COLOR

Change Color of Nodes and Items In the tree structure, the color is the property of each node or individual item.

Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Change color combination for node Get color combination for node Change color combination for item Get color combination for item
Display Rows with Stripes

Classic ABAP List No No

Full Screen No Yes

In the Container No Yes

Class Method CL_SALV_NODE SET_ROW_STYLE GET_ROW_STYLE CL_SALV_ITEM SET_STYLE GET_STYLE

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. Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP List Yes Yes Full Screen Yes No In the Container Yes No

Methods Function Set striped pattern Check whether the striped pattern is set Class Method CL_SALV_DISPLAY_SETTINGS SET_STRIPED_PATTERN IS_STRIPED_PATTERN

Accessible Color Display To make colored identifiers of ALV elements accessible to visually-impaired users it is necessary to maintain a tool tip for the color. This takes place using the method ADD_TOOLTIP of the class CL_SALV_TOOLTIPS. You can find more information in the class documentation in the system.

Setting Text Properties


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:

y y y y y

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.
Font in Design Object

In the classic ABAP list, the various element types that you are able to use in a design object differ in the font. In the other two display types they differ in font, font size and font color. The following graphic provides a comparison of the fonts as they are set in the various display types for the ALV output for the four element types.

This is how you set the font in the design object using a choice of element type.
Font in the Tree Structure

You are able to choose between three fonts in each item:

y y y

Standard font A non-proportional font (all characters require the same amount of space) A proportional font (characters have different widths) Display type Classic ABAP list No No Full screen No Yes In the Container No Yes

ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods

Function

Class

Method

Set font of an item Get font of an item

CL_SALV_ITEM SET_FONT GET_FONT

Set Alignment of the Text in the Column You are able to set where the content of a column will be put:

y y y

Left aligned Centered Right-aligned

You are able to change the alignment of text in the design object (header and footer area of page or list) and in the ALV output.
Alignment in the ALV Output

You are able to set the alignment of the text for each column in the ALV output separately.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class

Method

Set alignment of the column Get alignment of the column


Alignment in the Design Object

CL_SALV_COLUMN SET_ALIGNMENT GET_ALIGNMENT

For the following elements, you are able to set the alignment in the design object:

y y y y

Header Action information Label Text

The alignment is only applicable when the following applies:

y y

The text is in a table-type layout. The column in which the text is located is wide enough.

You set the alignment for each text element individually.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function Class

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Method

Set alignment in the design object Get alignment in the design object

CL_SALV_FORM_ACTION_INFO SET_HORIZONTAL_ALIGNMENT CL_SALV_FORM_HEADER_INFO CL_SALV_FORM_LABEL CL_SALV_FORM_TEXT GET_HORIZONTAL_ALIGNMENT

Determine Lowercase and Uppercase If the texts in the internal data table use both uppercase and lowercase letters, you are able to choose whether they will be maintained in the ALV output or whether the lowercase letters should be converted to uppercase letters.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class

Method

Convert lowercase letters to uppercase Check whether lowercase letters

CL_SALV_COLUMN SET_LOWERCASE IS_LOWERCASE

are to be converted to uppercase letters


Determine Display of Empty Cells You are able to determine whether empty cells are to contain a zero or a space.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class

Method

Determine display of empty cells Check how empty cells are to be displayed

CL_SALV_COLUMN SET_ZERO IS_ZERO

Hiding Lines Between Columns and Rows


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:

y y y

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)

Displaying Lines in the ALV Output To display lines in the ALV output, you use one method for lines and one for columns.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list

Classic ABAP list Yes Yes (only horizontal)

Full screen

In the Container Yes

Yes

Tree structure

No

No

Methods Function
Display lines between rows Checks whether lines between the rows are being displayed Display lines between columns Checks whether lines between the columns are being displayed Displaying Lines in the Design Object You are only able to display lines in table-type layouts within the design object. Here you use one method to determine whether you want to display vertical, horizontal, both or no lines. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Yes Yes Yes Yes Yes Yes Classic ABAP list Full screen In the Container

Class
CL_SALV_DISPLAY_SETTINGS

Method
SET_HORIZONTAL_LINES IS_HORIZONTAL_LINES SET_VERTICAL_LINES IS_VERTICAL_LINES

Methods Function
Displaying Lines in the Design Object

Class
CL_SALV_FORM_LAYOUT_GRID

Method
SET_GRID_LINES

Changing the Display of Numeric Values


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:

y y y y

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:

y 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. y 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:

y Setting properties such as number of decimal places, units of measure, currency and rounding y y y Displaying or hiding sign Hide or display leading zeros Determining Display of Empty Cells

The following is valid for all of these functions:

Display type Classic ABAP list ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Yes Yes

Full screen

In the Container Yes Yes

Yes Yes

Determining Decimal Places, Units of Measure, Currency and Rounding You determine the number of decimal places, along with the unit of measure, currency and rounding for each column individually.

Methods
Function Determine number of decimal places Get number of decimal places Determine unit of measure Get unit of measure Determine currency Get currency Determine rounding Get rounding Class CL_SALV_COLUMN Method SET_DECIMALS GET_DECIMALS SET_CURRENCY GET_CURRENCY SET_QUANTITY GET_QUANTITY SET_ROUND GET_ROUND

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.
Displaying or Hiding sign By default, positive numbers are displayed without sign, and negative numbers are displayed with sign. You are able to determine that the sign (-) not be displayed for negative numbers.

Methods
Function Displaying or hiding sign Checks whether sign is being displayed or hidden Class CL_SALV_COLUMN Method SET_SIGN HAS_SIGN

Hiding or Displaying Leading Zeros For columns with data types n or NUMC (numeric text), the places that are in front of the value are filled with zeros (0). You are able to hide or display these zeros in front of a value. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP list Yes Yes Full screen In the Container Yes Yes

Yes Yes

Methods
Function Hiding or Displaying Leading Zeros Checks leading zeros are being displayed or hidden Class CL_SALV_COLUMN Method SET_LEADING_ZERO HAS_LEADING_ZERO

Defining Column Width


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). Features You are able to make the following settings for column width:

y y y y y

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)

Set Output Width You are able to set the width of a column in the content of the ALV output no matter how large the field has been defined for the internal data table.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set column width Get column width Get column width of the referenced data element
Set Width of Hierarchy Column

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class Method CL_SALV_COLUMN SET_OUTPUT_LENGTH


GET_OUTPUT_LENGTH GET_DDIC_OUTPUTLEN

You are able to choose whether you want to specify the width of the hierarchy column in the tree structure in pixels or in characters.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set whether the width of the hierarchy column is specified in characters or in pixels Check whether the width of the hierarchy column is specified in characters or in pixels Set width of hierarchy column

Classic ABAP list No No

Full screen No Yes

In the Container No Yes

Class Method CL_SALV_ SET_HIERARCHY_SIZE_IN_PIXEL TREE_SETTINGS IS_HIERARCHY_SIZE_IN_PIXEL

SET_HIERARCHY_SIZE

Get width of hierarchy column

GET_HIERARCHY_SIZE

Width of a Column in Table-Type Layout of a Design Object If you use a table-type layout in a design object, you control the width of the column using its contents: the longer the text in a cell, the wider the column. Adapt Width to Space Required by Values You are able to automatically set the width of columns so that all values are displayed completely by optimizing the column. You can make this setting for each column individually or for all columns simultaneously.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Optimize individual column Check whether a column is optimized Optimize all columns simultaneously Check whether all columns are optimized

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class CL_SALV_COLUMN

Method SET_OPTIMIZED IS_OPTIMIZED

CL_SALV_COLUMNS SET_OPTIMIZE 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.

Arranging a Data Record in Multiple Rows


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.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Arranging values in multiple rows Get rows in which the data is being displayed

Classic ABAP list Yes Yes

Full screen No No

In the Container No No

Class Method CL_SALV_COLUMN SET_ROW GET_ROW

ALV Output Display in a Dialog Box


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:

y y

Display ALV output in a dialog box Specify the size of the dialog box

The following is valid for all of these functions:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Display ALV Output in a Dialog Box

Classic ABAP list Yes Yes

Full screen Yes No

In the Container No No

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

Function Display ALV output in a dialog box

Get position of the dialog box

Class Method CL_SALV_TABLE SET_SCREEN_POPUP CL_SALV_HIERSEQ_TABLE (Parameter START_COLUMN bzw. START_LINE) GET_SCREEN_POPUP

Specify the Size of the Dialog Box You specify the size of the dialog box only indirectly:

y The width of the dialog box is determined from the distance between the right side of the dialog box and the edge of the screen y The height of the dialog box is determined from the distance between the bottom of the dialog box and the upper edge of the work area.

Methods

Function Specify the Size of the Dialog Box Specify the size of the

Class Method CL_SALV_TABLE SET_SCREEN_POPUP CL_SALV_HIERSEQ_TABLE (Parameter END_COLUMN bzw. END_LINE) GET_SCREEN_POPUP

dialog box

Handling Events and Functions


The ALV output cannot be edited, which means that users cannot make changes to the content of the ALV output themselves. The user can only change the display of the content, for example by sorting or filtering specific data records. However, you are able to enable and handle different types of interaction by the user that do not affect the content of the ALV output, but do trigger certain functions.

y You provide Pushbuttons or Menu Entries for generic ALV functions or define your own application-specific functions y In the columns of the ALV output, you provide elements for interaction such as pushbuttons, checkboxes or hyperlinks y y You process the users clicks and double clicks on the ALV output. You process specific key actions from the user

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.

Make Functions Available


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:

y 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. y 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:

y y y

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 Setting Screen Status You make the following settings with screen status in the full-screen display of the ALV output:

y y y

Which generic ALV functions and which custom functions the user can use Which functions are offered as pushbuttons and which are offered as a menu entry In which order the pushbuttons or menu are displayed

By default, the following screen statuses will be used:

y For the simple, two-dimensional table and the hierarchical-sequential list of the screen status SALV_TABLE_STANDARD in the function group SALV_METADATA_STATUS y For the tree structure of the screen status STANDARD_TREE in the function group SLVC_FULLSCREEN 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.

Display type ALV Tool Simple, two-dimensional table

Classic ABAP list Yes

Full screen Yes

In the Container No

Hierarchical-sequential list Tree structure Methods Function Set screen status Get screen status

Yes Yes No

Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE

Method SET_SCREEN_STATUS GET_SCREEN_STATUS

Use of Generic ALV Functions


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).
When Users Execute the Function

When users select the pushbutton for a generic ALV function, they trigger two events (one after the other):

y BEFORE_SALV_FUNCTION The event takes place before the function is executed y AFTER_SALV_FUNCTION The event takes place after the function is finished
Both events originate in the classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE. If you register your application for these events, you are able to handle user actions and start a desired function.

Arrangement of the Pushbuttons

Depending on whether you use a generic function in an ALV output in a container or in a full-screen display, you proceed differently to set the position of a pushbutton or menu entry:

y In container display (simple, simple two-dimensional table or tree structure) you are not able to change the sequence of the pushbuttons. y 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 call the SET functions. 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:

y y y

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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-Sequential List Tree structure
Get function settings

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

With every function that you activate, you generate an object of class CL_SALV_FUNCTION. You manage all of these objects using the list of all function objects: CL_SALV_FUNCTIONS_TREE (for the tree

structure) or CL_SALV_FUNCTIONS_LIST (for the simple, two-dimensional table or the hierarchicalsequential list). The method GET_FUNCTIONS that returns the settings for all functions exists in each main ALV class. Using this object, you make all settings for the generic ALV functions.

Methods Function Get FUNCTIONS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE Method GET_FUNCTIONS

Get all function objects Check whether a function is a generic ALV function

GET_FUNCTIONS IS_SALV_FUNCTION

Enable Generic ALV Functions For every generic ALV function, there is a setter method that you use to make the pushbutton or menu entry for the function visible and usable for the user. You have various options for displaying generic ALV functions:

You enable each generic ALV function individually

y You enable a function group. All of the functions for this function group are enabled simultaneously y 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 Function Enable individual generic ALV functions Enable function group Enable all generic ALV functions Class CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE SET_GROUP_ <Function group> SET_ALL Method SET_ <generic ALV function>

Enable preset default selection of generic ALV functions

CL_SALV_FUNCTIONS_LIST

SET_DEFAULT

Check Visibility and Activation Status of a Self-Defined Function With the setter methods (see above), you render a generic ALV function visible or hidden. In some cases, a generic ALV function can be visible, but temporarily not operable: the generic ALV function is disabled. Although you are able to change the activation status of self-defined functions, you do not have this option for generic ALV functions. Here the internal logic of ALV determines whether or not a function is operable.

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 Function Check visibility Check activation status Class CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE Method IS_VISIBLE IS_ENABLED

Using Self-Defined, Application-Specific Functions


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.
When Users Execute the Function

If users select the pushbutton for a function that you have defined, they trigger the event ADDED_FUNCTION of classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE. If you register your application for this event, you get control in the method for the event handler and can start your desired function code.
Arrangement of the Pushbuttons

Depending on whether you use a self-defined function in an ALV output in a container or in a full-screen display, you proceed differently to set the position of a pushbutton or menu entry:

In the container display (simple, two-dimensional table or tree structure) you are able to choose whether you want to place the pushbuttons for self-defined functions to the right or the left of the pushbutton for the generic ALV functions: You also use the sequence in which you create the self-defined functions to set the sequence of the pushbuttons. 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 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
Get Function Settings With every function that you activate, you generate an object of class CL_SALV_FUNCTION. You manage all of these objects using the list of all function objects: CL_SALV_FUNCTIONS_TREE (for the tree structure) or CL_SALV_FUNCTIONS_LIST (for the simple, two-dimensional table or the hierarchicalsequential list). The method GET_FUNCTIONS that returns the settings for all functions exists in each main ALV class. Using this object, you make all settings for the self-defined functions.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Methods Function Get FUNCTIONS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE


Create, Display, and Delete Self-Defined Functions Depending on whether you use a self-defined function in an ALV output in a container or in a full-screen display, you proceed differently to display the function:

Method GET_FUNCTIONS

In the container display (simple, two-dimensional table or tree structure), you strictly create a function object with the desired properties and display the pushbutton. In the other display types, you generate the function object indirectly by entering the selfdefined function into the screen status. Here the function is display directly. You do not have to provide any other commands for the display.
In full-screen displays, you determine the appearance, tooltip and position for the function using the screen status, but in the container display, you make these settings when you are generating the function object.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Create and display a function object for a selfdefined function Delete function object Check whether a function object already exists Set text for a pushbutton Set icon for a pushbutton

Classic ABAP list No No

Full screen No No

In the Container Yes Yes

Class CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE

Method ADD_FUNCTION

REMOVE_FUNCTION IS_ITEM ADD_FUNCTION (Parameter TEXT) ADD_FUNCTION (Parameter ICON)

Set position within the application toolbar Set tooltip for the pushbutton

ADD_FUNCTION (Parameter POSITION) ADD_FUNCTION (Parameter TOOLTIP)

Check Visibility and Activation Status of a Self-Defined Function You can show and hide pushbuttons or menu entries for self-defined functions. In addition you are also able to affect the operability of a self-defined function in contrast to generic ALV functions: you enable or disable the function. For the visibility of self-defined functions, the following is valid:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

For the activation status of self-defined functions, the following is valid:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Show or hide a selfdefined function Check visibility Enable / disable a selfdefined function Check activation status

Classic ABAP list No No

Full screen No No

In the Container Yes Yes

Class CL_SALV_FUNCTIONS_LIST

Method SET_FUNCTION

CL_SALV_FUNCTIONS_TREE IS_VISIBLE ENABLE_FUNCTION IS_ENABLED

Instead of a Self-Defined Function, Execute a Generic ALV Function Usually you want to execute the self-defined function for which you have defined a pushbutton or menu entry upon user action. However, in specific cases, if you wish to execute a function other that the one

originally set, you are able to specify the desired (alternative) generic ALV function in the event handler routine of the event ADDED_FUNCTION.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Instead of a self-defined function, execute a generic ALV function

Classic ABAP list No No

Full screen No No

In the Container Yes Yes

Class Method CL_SALV_TABLE SET_FUNCTION CL_SALV_TREE

Interactive Element Display


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:

y 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. y Pushbutton You are able to handle user actions on this element with an event. y 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. y 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:

y y

Get current setting Assign cell type or type of item

Get Current Setting In list-type ALV outputs, you are able to assign the cell type in two ways:

y All cells of a column get the same cell type. Here the cell type is thus a property of the column. y 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 Function Get the property of a column Check whether a column exists for cell types Get the cell type of a column Get properties of an item Class CL_SALV_TABLE Method GET_COLUMNS

CL_SALV_COLUMNS_LIST GET_CELL_TYPE_COLUMN

CL_SALV_COLUMN_LIST CL_SALV_TREE CL_SALV_NODES CL_SALV_NODE CL_SALV_ITEM

GET_CELL_TYPE GET_NODES GET_NODE GET_ITEM GET_HIERARCHY_ITEM GET_TYPE

Assign Cell Type or Type of Item If all prerequisites are fulfilled for displaying an interactive element in a cell or item, you are able to assign the type to the cell or item. See the prerequisites for each of the individual elements below.

Methods

Function Display element in a cell Display element in an item

Class Method CL_SALV_COLUMN_LIST SET_CELL_TYPE CL_SALV_ITEM SET_TYPE

Checkbox Display
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 hierarchicalsequential list, however, you are not able to activate the checkboxes, which means the user is not able to change the value of a checkbox.
If the User Changes the Value

You are able to enable checkboxes, which means you allow the user to change the value of the checkbox. Then you are able to handle the following events with your application:

In the simple, two-dimensional table, the user triggers the event LINK_CLICK from class CL_SALV_EVENTS_TABLE by changing the checkbox. In the tree structure, the user triggers the event CHECKBOX_CHANGE from class CL_SALV_EVENTS_TREE
Data Type, Cell Type and Value

The cells or items in which you wish to display the checkbox must have an alphanumeric data type. Depending on whether you are using checkboxes in list-type ALV outputs or in the tree structure, you proceed differently when setting the value of the checkbox:

In the tree structure, you set two properties of individual items:


y y Checkbox can be changed/cannot be changed Indicator is set/not set

In the other ALV tools, you control the display of the checkbox using the combination of cell type and value of the cell:
y y The CHECKBOX cell type always displays a disabled checkbox. The cell type CHECKBOX_HOTSPOT shows an enabled checkbox For the values 1 or X, the indicator for the checkbox is set. For the values 0 or , the indicator is not set.

The following table shows which value a cell or an item needs to include so that the checkbox is displayed as you want it to be: Value of a Checkbox Checkbox Description Checkbox enabled Indicator not set Checkbox enabled Indicator set Checkbox disabled Indicator not set Checkbox disabled Indicator set Checkbox hidden Value of the Cell CHECKBOX_ 0 or HOTSPOT CHECKBOX_ 1 or X HOTSPOT CHECKBOX 0 or CHECKBOX CHECKBOX CHECKBOX_ HOTSPOT
Features You are able to make the following settings for checkboxes:

Cell Type

1 or X -

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
Enable/Disable Checkbox in the Item In order for the user to be able to change the value of a checkbox in the tree structure, you have to enable it.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Enable checkbox Check whether the checkbox is enabled

Classic ABAP list No No

Full screen No Yes

In the Container No Yes

Class Method CL_SALV_ITEM SET_EDITABLE IS_EDITABLE

Enable/Disable the Checkbox in the Cell In list-type ALV outputs, you enable or disable a checkbox using the cell type:

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.
Set/Remove Indicator for the Checkbox in the Item You are able to change the value of a checkbox in the tree structure using your application.

Display type ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set the indicator for the checkbox Check whether the indicator for the checkbox is set

No No

No Yes

No Yes

Class Method CL_SALV_ITEM SET_CHECKED IS_CHECKED

Set/Remove Indicator for the Checkbox in the Cell In list-type ALV outputs, you can only control whether the indicator of a checkbox is set or not with the value of the cell. In enabled checkboxes (cell type CHECKBOX_HOTSPOT), you are able to use the event LINK_CLICK to adapt the value of the cell when the user clicks on the checkbox.

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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list No No

Full screen No Yes

In the Container Yes Yes

If users select a pushbutton, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_TREE)
y Features You are able to make the following settings for pushbuttons:  ...

Display pushbutton (assign cell and item type)

Display the Pushbutton

y To display a cell as pushbutton in container display of a simple, two-dimensional table, use the cell type BUTTON. y To display a pushbutton in a tree structure, use the type of item BUTTON.

Internet Address Display


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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Features

Classic ABAP list Yes Yes

Full screen Yes No

In the Container Yes No

You are able to make the following settings for Internet addresses:

y y y

Get hyperlink objects Create, change and delete hyperlink objects Display Internet Address

Define Internet address as click area (assign cell type)

Get Hyperlink Objects In every main ALV class in which display of hyperlink objects is possible, there is a method GET_FUNCTIONAL_SETTINGS, which returns, among other things, the hyperlink objects of the ALV output (class CL_SALV_HYPERLINKS). Using this object you obtain the desired hyperlink object with the methods GET or GET_HYPERLINK.

Methods Function Get hyperlinks Class CL_SALV_TABLE Method GET_FUNCTIONAL_ SETTINGS

Get all hyperlink objects Get a specific hyperlink object Get Internet address Get key

CL_SALV_HIERSEQ_TABLE CL_SALV_FUNCTIONAL_SETTINGS GET_HYPERLINKS CL_SALV_HYPERLINKS GET CL_SALV_HYPERLINKS GET_HYPERLINK

CL_SALV_HYPERLINK

GET_HYPERLINK GET_HANDLE

Create, Change and Delete Hyperlink Objects You are able to create any number of hyperlink objects. A hyperlink object includes two components: the Internet address and a key that you can use later to address the hyperlink object. You are able to delete hyperlink objects either individually or all at once.

Methods Function Create hyperlink object Delete individual hyperlink object Delete all hyperlink objects Change hyperlink object Class Method CL_SALV_HYPERLINKS ADD_HYPERLINK REMOVE_HYPERLINK

CLEAR

CL_SALV_HYPERLINK

SET_HYPERLINK

(address)
Define Internet Address as Click Area To define the Internet address in a cell as a click area, that is, to display it underlined, use the Cell Type LINK.

Click Area Display


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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

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)
y Features You are able to make the following settings for click areas:  ...

Display click area (assign cell and item type)

Click Area Display

y y

To define a cell as a click area in a list-type ALV output, use the cell type HOTSPOT To define an item in a tree structure as a click area, use the type of item LINK.

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

y 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 For more information on clicking options, see Displaying Interactive Elements
Features You are able to make the following settings for mouse actions:

y y

Functions for single click Functions for Double Click or F2

The following is valid for all of these functions:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Functions for Single Click

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

So that the user not only selects the rows or the item with a single click, but also triggers a specific function, you have to ensure the following:

y The cells/items for which these functions are to be triggered have a specific Cell or Item Type:

y y

 

In list-like ALV outputs, the cells have the cell type HOTSPOT In tree structures the items have the item type LINK

y You have registered your application for the event LINK_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE) and programmed it into a suitable event handler.
Functions for Double Click or F2 You have two options for processing the double click or F2 being pressed:

y You register your application for the event DOUBLE_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE) or y You specify the function code of the function directly that is to be executed with a double click or F2. 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 Function Set function code Get function code Class Method CL_SALV_FUNCTIONAL_SETTINGS SET_F2_CODE GET_F2_CODE

Handling Keyboard Actions


Use Some keys on the keyboard have special meaning in ALV and you can assign specific functions to others:

y F1 Function Key The user calls a help text for the selected column using the F1 function key. y 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. y F4 function key 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:

y y

Using an F1 Help Text for Another Data Element Assigning any functions to keys

Assigning Any Functions to Keys In the tree structure, you are able to specify functions for a selection of keys and key combinations that are to be executed when the user presses these buttons.

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
You proceed in two steps:

Classic ABAP list No No

Full screen No Yes

In the Container No Yes

y You specify which of the possible keys trigger the event KEYPRESS of class CL_SALV_EVENTS_TREE. You repeat this specification for every key that you wish to register for the event. y You specify which function will be executed when the user presses the appropriate key. To do this, register the application for the event and program the desired event handler.
You can assign the following keys and key combinations in the tree structure with the desired functions:

y y y y y y y

F1 function key F4 function key Remove Enter key Insert Control plus X Control plus C

Control plus V

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 Function Register the key for an event Delete entire list of keys that trigger the event Class Method CL_SALV_EVENTS_TREE ADD_KEY_FOR_KEYPRESS REMOVE_ALL_KEYS_ FOR_KEYPRESS

Providing Help for Users


You are able to provide several types of help for users who are working with ALV:

y F1 Help For each column, you specify a DDIC element that includes a suitable F1 help text. If the user selects a column and presses the F1 function key, the help text appears. y ToolTips You are able to define tooltips for various elements of the ALV output. If the user moves the mouse pointer over the element and rests it there for a moment, the text box with the tooltip text appears. 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.

Provide Tooltips
Use Tooltips allow you to define short help texts for various elements of the ALV output:

y 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.

y 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:

y y y y

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:

y y y y y

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

Tooltip Object Generation and Management


Use You are able to assign the tooltip objects to the following elements:

y y y

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:

y y y

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:

y y

Get tooltip object Create, change and delete tooltip object

The following is valid for all of these functions:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Get Tooltip Object In every main ALV class there is a method that returns all tool tip objects of the ALV output (class CL_SALV_TOOLTIPS). Using this object you obtain the desired tooltip object with the methods GET or GET_TOOLTIP.

Methods Function Get tooltips Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_FUNCTIONAL_SETTINGS CL_SALV_TREE_SETTINGS CL_SALV_TOOLTIPS CL_SALV_TOOLTIPS Method GET_FUNCTIONAL_ SETTINGS GET_TREE_SETTINGS GET_TOOLTIPS GET GET_TOOLTIP

Get all tooltip objects Get specific

tooltip object
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 Function Get tooltip object Delete individual tooltip object Delete all tooltip objects Change the text for the tooltip object Get the text for the tooltip object Get type of tooltip Get indicator for element Class Method CL_SALV_TOOLTIPS ADD_TOOLTIP REMOVE_TOOLTIP CLEAR CL_SALV_TOOLTIP SET_TOOLTIP GET_TOOLTIP GET_TYPE GET_VALUE

Generation of ToolTips for Icons and Symbols


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:

The indicator @DL\QToolTip for Icon ABC@ shows the following tooltip:

For symbols, proceed in the same way.

F1 Help Provision
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

Using an F1 Help Text from Another DDIC Element

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Use an F1 help text from another DDIC element Get name of the DDIC element from which the F1 help text has been taken

Classic ABAP list Yes Yes

Full screen Yes Yes

In the Container Yes Yes

Class Method CL_SALV_COLUMN SET_F1_ROLLNAME GET_F1_ROLLNAME

Making Settings for Printing


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:

Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure

Classic ABAP list Yes Yes

Full screen Yes No

In the Container Yes 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:

y y y y y y

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

Output Additional Information In addition to the actual ALV output you are able to output two areas in the printout:

y List information Information as to which filter and which sort are being applied to the ALV output and as to how many data records the ALV output is restricted. y Selection information Information as to which application-specific selection criteria the user used to call the ALV output (for example company code or material number)
If you activate one or both pieces of additional information, the corresponding information blocks are printed before the ALV output. You are able to determine whether a page break should be inserted after these information blocks, thus causing the additional information to appear on a separate page as a cover sheet, or whether the ALV output should be added directly after the additional information.

Methods Function Class Output of list CL_SALV_PRINT information Check whether list information are being output Output selection information Check whether selection information is being output Output additional information on a separate page Check whether additional information is being printed on a separate page
Output Standard Title of the Program 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.

Method SET_LISTINFO_ON IS_LISTINFO_ON

SET_SELECTIONINFO_ON IS_SELECTIONINFO_ON

SET_COVERPAGE_ON

IS_COVERPAGE_ON

Methods Function Class Method Output standard title of the CL_SALV_PRINT SET_REPORT_

program
Determine that the ALV Be Called in Print Mode

STANDARD_HEADER_ON

You are able to print the ALV output directly without having to first display it on the screen.

Methods Function Print ALV output directly Check whether ALV output is being printed directly Class Method CL_SALV_PRINT SET_PRINT_ONLY IS_PRINT_ONLY

Take Actual List Size into Consideration During Printing You can use the application to determine how wide the list should be in the printout. If the width of the ALV output has changed (for example because the user is showing columns), it can be that the page is not big enough to show all the information. You are able to set that ALV determine the current size before printing and then changes the print parameters accordingly.

Methods Function Take actual list size into consideration during printing Check whether the list size can be adapted Class Method CL_SALV_PRINT SET_PRINT_PARAMETERS_ ENABLED IS_PRINT_PARAMETERS_ ENABLED

You might also like