129
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 Returns Object of Type Remarks GET_AGGREGATIONS CL_SALV_AGGREGATIONS GET_COLUMNS CL_SALV_COLUMNS_TABLE or CL_SALV_COLUMNS_HIERSEQ or CL_SALV_COLUMNS_TREE GET_DISPLAY_SETTINGS CL_SALV_DISPLAY_SETTINGS Not in CL_SALV_TREE GET_EVENT CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE GET_FILTERS CL_SALV_FILTERS Not in CL_SALV_TREE GET_FUNCTIONAL_SETTIN GS CL_SALV_FUNCTIONAL_SETTINGS Not in CL_SALV_TREE GET_FUNCTIONS CL_SALV_FUNCTIONS_LIST Not in CL_SALV_TREE CL_SALV_FUNCTIONS_TREE Only in CL_SALV_TREE GET_LAYOUT CL_SALV_LAYOUT GET_LEVEL CL_SALV_HIERSEQ_LEVEL Only in CL_SALV_HIERSEQ_TABLE GET_NODES CL_SALV_NODES Only in CL_SALV_TREE GET_PRINT CL_SALV_PRINT GET_SELECTIONS CL_SALV_SELECTIONS Not in CL_SALV_TREE CL_SALV_SELECTIONS_TREE Only in CL_SALV_TREE GET_SORTS CL_SALV_SORTS Not in CL_SALV_TREE GET_TREE_SETTINGS CL_SALV_TREE_SETTINGS Only in CL_SALV_TREE

Sub Objects of Alv Classes

Embed Size (px)

Citation preview

Page 1: Sub Objects of Alv Classes

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 Returns Object of Type RemarksGET_AGGREGATIONS CL_SALV_AGGREGATIONS  GET_COLUMNS CL_SALV_COLUMNS_TABLE or

CL_SALV_COLUMNS_HIERSEQ or

CL_SALV_COLUMNS_TREE

 

GET_DISPLAY_SETTINGS CL_SALV_DISPLAY_SETTINGS Not in CL_SALV_TREEGET_EVENT CL_SALV_EVENTS_TABLE or

CL_SALV_EVENTS_HIERSEQ or

CL_SALV_EVENTS_TREE

 

GET_FILTERS CL_SALV_FILTERS Not in CL_SALV_TREEGET_FUNCTIONAL_SETTINGS

CL_SALV_FUNCTIONAL_SETTINGS Not in CL_SALV_TREE

GET_FUNCTIONS CL_SALV_FUNCTIONS_LIST Not in CL_SALV_TREECL_SALV_FUNCTIONS_TREE Only in CL_SALV_TREE

GET_LAYOUT CL_SALV_LAYOUT  GET_LEVEL CL_SALV_HIERSEQ_LEVEL Only in

CL_SALV_HIERSEQ_TABLEGET_NODES CL_SALV_NODES Only in CL_SALV_TREEGET_PRINT CL_SALV_PRINT  GET_SELECTIONS CL_SALV_SELECTIONS Not in CL_SALV_TREE

CL_SALV_SELECTIONS_TREE Only in CL_SALV_TREEGET_SORTS CL_SALV_SORTS Not in CL_SALV_TREEGET_TREE_SETTINGS CL_SALV_TREE_SETTINGS Only in CL_SALV_TREE

 

Page 2: Sub Objects of Alv Classes

If one of the classes uses another class, you can also get its objects using the Get methods.

Class Used Includes Get method Returns Object of TypeCL_SALV_AGGREGATIONS GET_AGGREGATION CL_SALV_AGGREGATIONCL_SALV_COLUMNS_TABLE GET_COLUMN CL_SALV_COLUMNCL_SALV_COLUMNS_HIERSEQCL_SALV_COLUMNS_TREECL_SALV _FUNCTIONAL_SETTINGS

GET_DROPDOWNS CL_SALV_DROPDOWNSGET_HYPERLINKS CL_SALV_HYPERLINKSGET_TOOLTIPS CL_SALV_TOOLTIPS

CL_SALV_FUNCTIONS_LIST GET_FUNCTIONS CL_SALV_FUNCTIONCL_SALV_FUNCTIONS_TREECL_SALV_FILTERS GET_FILTER CL_SALV_FILTERCL_SALV_NODES GET_NODE CL_SALV_NODECL_SALV_SORTS GET_SORTS CL_SALV_SORT

Title of the ALV Output 

Methods

Function Class MethodChange wording of the title (simple, two-dimensional table and hierarchical-sequential list)

CL_SALV_DISPLAY_SETTINGS SET_LIST_HEADER

Get current title GET_LIST_HEADERChange wording of the title (tree structure)

CL_SALV_TREE_SETTINGS SET_HEADER

Get current title GET_HEADER

Change Font Size of the Title

Methods

Function Class MethodChange Font Size of the Title

CL_SALV_DISPLAY_SETTINGS SET_LIST_HEADER_SIZE

Get current font size

GET_LIST_HEADER_SIZE

 

Page 3: Sub Objects of Alv Classes

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:        Standard columns        Lead columns, which are columns that have a special textual meaning in your ALV output.        Special columns that control the meaning or display of other columns or that are reserved for special functionsSome of the settings that you make for a column are valid for all of these column types, but some are only reserved for a specific type of column.

Use

You are able to make the following settings for all columns.

        Set the visibility of the column        Change Position of the Column within the ALV Output        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.

Page 4: Sub Objects of Alv Classes

Methods

Function Class MethodGet all column objects CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_COLUMNS

CL_SALV_COLUMNS GETGet all column objects for a hierarchy level

CL_SALV_HIERSEQ_LEVEL GET_COLUMNS

Get specific column object

CL_SALV_COLUMNS GET_COLUMN

Get technical name of the current column

CL_SALV_COLUMNCL_SALV_ITEMCL_SALV_AGGREGATIONCL_SALV_SORT

GET_COLUMNNAME

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.

        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 user’s column set.

Methods

Function Class MethodSet the visibility of a column CL_SALV_COLUMN SET_VISIBLECheck setting for visibility IS_VISIBLEDefine column as technical column SET_TECHNICALCheck whether column is a technical column

IS_TECHNICAL

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

Methods    

Function Class MethodChange the position of a CL_SALV_COLUMNS SET_COLUMN_POSITION

Page 5: Sub Objects of Alv Classes

columnGet 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:        You change the description of an individual column        You change the description of multiple columns simultaneously.No matter whether the type of your column agrees with that of the referenced DDIC field, the following properties are always transferred to your column.        Short, medium and long text of the column header        F1 help textIf the typing also matches (internal type and internal length), the remaining properties are also transferred, such as        F4 help and search help        Data element and domain        Columns for amounts, currency, decimal places and rounding

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 Class MethodGet name of the DDIC data element

CL_SALV_COLUMN

GET_DDIC_ROLLNAME

Get DDIC data type GET_DDIC_DATATYPEGet DDIC decimal places

GET_DDIC_DECIMALS

Get DDIC domains GET_DDIC_DOMAINGet output length according to DDIC (CHAR)

GET_DDIC_OUTPUTLEN

If a column does not have a DDIC reference, you are able to retrieve the following properties:

Internal lengthTo do this, use the method GET_DDIC_INTLEN

Internal typeTo do this, use the method GET_DDIC_INTTYPE

Page 6: Sub Objects of Alv Classes

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 Class MethodChange DDIC reference for an individual column

CL_SALV_COLUMN SET_DDIC_REFERENCE

Get DDIC reference for the column

GET_DDIC_REFERENCE

Change DDIC reference for several columns

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:

        Determine wording of the column header        Display or hide column header        Determine whether the user can sort the table according to this column by clicking on the column header        Determine tooltip for the column header        Display an icon (only tree structure)

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.

Page 7: Sub Objects of Alv Classes

Methods

Function Class MethodDetermine version of the column header

CL_SALV_COLUMN SET_LONG_TEXT

SET_MEDIUM_TEXT

SET_SHORT_TEXTGet current column header

GET_LONG_TEXT

GET_MEDIUM_TEXT

GET_SHORT_TEXTDetermine column header of the hierarchy column of a tree structure

CL_SALV_TREE_SETTINGS SET_HIERARCHY_HEADER

Get column header of the hierarchy column of a tree structure

GET_HIERARCHY_HEADER

Display or Hide Column HeaderMethodsFunction Class MethodDisplay or hide column header

CL_SALV_COLUMNS_LIST

SET_HEADERS_VISIBLE

Check whether column headers are being displayed or hidden

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 Class MethodSet column header as pushbutton for sorting the table

CL_SALV_FUNCTIONAL_SETTINGS

SET_SORT_ON_HEADER_CLICK

Check whether column header is set as pushbutton for sorting the table

IS_SORT_ON_HEADER_CLICK

Page 8: Sub Objects of Alv Classes

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 Class MethodDetermine tooltip for the column header

CL_SALV_COLUMN SET_TOOLTIP

Get current tooltip for a column header

GET_TOOLTIP

Set tooltip for hierarchy column of a tree structure

CL_SALV_TREE_SETTINGS

SET_HIERARCHY_TOOLTIP

Get tooltip for hierarchy column of a tree structure

GET_HIERARCHY_TOOLTIP

Get all tooltip objects for column headers of the tree structure

GET_TOOLTIPS

Display Icon

In the column header of the hierarchy column for a tree structure, you can display an icon.

Methods

Function Class MethodDisplay icon in the column header of the hierarchy column ??

CL_SALV_TREE_SETTINGS

SET_HIERARCHY_ICON

Get icon currently being displayed

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:

Page 9: Sub Objects of Alv Classes

        Lead columns have a different color. This color is determined by the system.        You are able to determine whether a lead column moves when you scroll sideways through the screen like the other columns, or whether it stays where it is.         Lead columns can be found in the user’s 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:

        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 CL_SALV_COLUMN_LIST SET_KEYCheck whether a column is a lead column

IS_KEY

Defining a Color in a Lead Column

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 CL_SALV_COLUMNS_LIST SET_COLOR_COLUMNGet color column GET_COLOR_COLUMN

Page 10: Sub Objects of Alv Classes

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 CL_SALV_COLUMNS_LIST SET_KEY_FIXATIONChecks whether the lead columns are fixed

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

CL_SALV_COLUMN_LIST SET_KEY_PRESENCE_REQUIRED

Check whether the lead column can be hidden

  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 columnsThese columns are technical columns, which means they are usually not displayed. They contain information on how the contents are being displayed in another column. Examples of control columns are:

○ Color column (technical column) ○ Currency column (visible column)

Many of the properties that you assign to specific cells using control columns can also be assigned to a whole column (for example assigning a currency to a whole column).

Page 11: Sub Objects of Alv Classes

●      Graphic columnsTo 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 functionThese columns include functions that are only useful in very specific situations.Examples of these columns include:

○ Expansion column for the hierarchical-sequential list ○ Text Column for Labels in Results Rows for Intermediate Results ○ Counter Column to Determine the Number of Rows

Use

Depending on how you use a special column, you need to be aware of different things.

Using Control Columns

With control columns you assign specific properties to one or more cells.

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

Page 12: Sub Objects of Alv Classes

Currency column CL_SALV_COLUMN

SET_CURRENCY_COLUMNGET_CURRENCY_COLUMN

Column for decimal places

SET_DECIMALS_COLUMNGET_DECIMALS_COLUMN

Column for units of measure

SET_QUANTITY_COLUMNGET_QUANTITY_COLUMN

Rounding column SET_ROUND_COLUMNGET_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).

Page 13: Sub Objects of Alv Classes

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

Control column Class MethodColumn for cell types

CL_SALV_COLUMNS_LIST

SET_CELL_TYPE_COLUMNGET_CELL_TYPE_COLUMN

Color column SET_COLOR_COLUMNGET_COLOR_COLUMN

Hyperlink column SET_HYPERLINK_ENTRY_COLUMNGET_HYPERLINK_ENTRY_COLUMN

Dropdown column SET_DROPDOWN_ENTRY_COLUMNGET_DROPDOWN_ENTRY_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 Class MethodDefining the column as a icon column

CL_SALV_COLUMN_LIST SET_ICON

Check whether the current column is an icon column

IS_ICON

Define the column as a symbol column

SET_SYMBOL

Check whether the current column is an symbol column

IS_SYMBOL

Exception Column

The exception column is a special form of the graphic column:

It displays a status of the current data record with specific icons.

Page 14: Sub Objects of Alv Classes

The most common display of exception icons is the traffic light: You can display,   the release status, for example, with these icons.

As opposed to regular graphic columns, the exception column has additional properties:

●      The values in the exception column must be between 1 and 5●      It can only display a specific set of icons. You are able to choose the icons you wish to display from several exception groups. In the exception column itself, only the values allowed in this exception group are available●      Users cannot hide the exception column●      In list-type ALV outputs, the exception column is always displayed as the first column

Methods

Function Class MethodSpecify exception column

CL_SALV_COLUMNS_LIST

CL_SALV_COLUMNS_TREE

SET_EXCEPTION_COLUMN

Get exception group GET_EXCEPTION_COLUMNGET_EXCEPTION_SETTINGS(Parameter GROUP)

Results rows from aggregations remain empty in the exception column by default. In list-type ALV outputs, however, you are able to display exception icons. To do this, in the class CL_SALV_COLUMNS_LIST, use the method SET_EXCEPTION_COLUMN (Parameter CONDENSED). You check whether the results row is displaying an exception icon using the method IS_EXCEPTION_CONDENSED or GET_EXCEPTION_SETTINGS(Parameter CONDENSED).

You cannot use every exception group in every representation type of the simple, two-dimensional table or hierarchical-sequential list. The following table shows where you can use which exception group.

Exception Group

Icon Representation Classic ABAP List

Full screen

Containers Hierarch.-Seq.

List1 LIGHTS Yes Yes Yes Yes2 LED No No Yes No3 STATUS No No Yes No4 TREND No No Yes No5 MESSAGE No No Yes No6 ALERT No No Yes No7 FAILURE/INCOMPLETE/

CHECKED

No No Yes No

Page 15: Sub Objects of Alv Classes

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 Class MethodDefine expansion column CL_SALV_COLUMNS_HIERSE

QSET_EXPAND_COLUMN

Get current expansion 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 Class MethodDefine text column CL_SALV_COLUMN_LIST SET_TEXT_COLUMNGet current 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 Class MethodDefine count column CL_SALV_COLUMNS_LIS

TSET_COUNT_COLUMN

Get count column   GET_COUNT_COLUMN

Page 16: Sub Objects of Alv Classes

Header and Footer Areas of the ALV Output

Use

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

        Design Object Compilation

        Displaying a Design Object at Top or Bottom of the Whole ALV Output   

        Displaying a Design Object in Multiple Page ALV Outputs on Every Page

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 layoutAll elements are lined up in a row.

●      Table-type layoutYou 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.

Page 17: Sub Objects of Alv Classes

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 ClassRow-type layout CL_SALV_FORM_LAYOUT_FLOWTable-type layout CL_SALV_FORM_LAYOUT_GRID

Page 18: Sub Objects of Alv Classes

Element Type ClassAction Info CL_SALV_FORM_ACTION_INFOHeader Info CL_SALV_FORM_HEADER_INFOLabel CL_SALV_FORM_LABELText 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 Class MethodGenerate an element of the desired type

CL_SALV_FORM_LAYOUT_FLOW

CL_SALV_FORM_LAYOUT_GRID

CREATE_*

Move element SET_ELEMENTCount elements GET_ELEMENT_COUNTLink cells CL_SALV_FORM_LAYOUT_

GRIDCREATE_*

SET_ELEMENT(Parameter COLSPAN or ROWSPAN)

Show lines between columns and rows

SET_GRID_LINES

Get number of columns and rows

GET_COLUMN_COUNT

GET_ROW_COUNTSpecify which column contains the labels and which column

SET_COLUMN_LABEL_FOR

Page 19: Sub Objects of Alv Classes

contains the associated textsAdd rows ADD_ROW

Element Types

You have similar functions available for the element types:

Methods

Function Class MethodEnter text CL_SALV_FORM_ACTION_INFO

CL_SALV_FORM_HEADER_INFO

CL_SALV_FORM_LABEL

CL_SALV_FORM_TEXT

SET_TEXTEnter tooltip SET_TOOLTIPSpecify alignment within a cell

SET_HORIZONTAL_ALIGNMENT

GET_HORIZONTAL_ALIGNMENT

Specify the text element to which the label belongs

CL_SALV_FORM_LABEL SET_LABEL_FOR

GET_LABEL_FOR

Example

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

...

*... END_OF_LIST

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:

Page 20: Sub Objects of Alv Classes

...

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

Page 21: Sub Objects of Alv Classes

●      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 Class MethodAllow Top of List with more than

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

SET_MODUS

 

Page 22: Sub Objects of Alv Classes

maximum permitted number of lines

with the following constants:Sequencing:

Top of List, Top of Page

CL_SALV_FORM_CONTENT=>

C_MODUS_EXCEED_TOL_TOPSequencing:

Top of Page, Top of List

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 Class MethodBefore output, on screen CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

SET_TOP_OF_LIST

GET_TOP_OF_LISTAfter output, on screen SET_END_OF_LIST

GET_END_OF_LISTBefore output, on printout SET_TOP_OF_LIST_PRINT

GET_TOP_OF_LIST_PRINTAfter output, on printout SET_END_OF_LIST_PRINT

GET_END_OF_LIST_PRINT

 

 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

Page 23: Sub Objects of Alv Classes

        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

        Both in the TOP_OF_PAGE and in the END_OF_PAGE events, you are able to determine the actual number of pages using the PAGE parameter.

        In the TOP_OF_PAGE event, you are also able to use the TABLE_INDEX parameter to get the table index of the entry. The table index is displayed on the current page.

        In order to be able to display the desired design object in the END_OF_PAGE event, you have to expressly reserve the required number of lines. To do this, use the method SET_RESERVE_LINES in the CL_SALV_PRINT class. With the SET_RESERVE_LINES method you determine how many lines are served.

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.

Page 24: Sub Objects of Alv Classes

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

        Determining Data Tables for the Header- and Position Level

        Linking Data Tables for the Header and Position Level

        Displaying or Hiding Position Rows

You use most of the functions of the hierarchical-sequential list analog to the simple, two-dimensional table (such as aggregation, sorting, filter). Here you also have to specify for which of the hierarchy levels you want to execute the function.

Page 25: Sub Objects of Alv Classes

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 foreign-key relationships.

Methods

Function Class MethodLink data tables CL_SALV_HIERSEQ

_TABLE

FACTORY(Parameter T_BINDING_LEVEL1_LEVEL2)SET_DATA(Parameter T_BINDING)

Get foreign key relationships

CL_SALV_HIERSEQ_LEVEL

GET_BINDING

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:

        You are able to hide or display the position rows of a specific header row using the contents of this expansion column.

        A symbol is displayed in each header row that the user can click to manually hide or display the associated position rows.

        You are able to hide or display the position rows for all header rows simultaneously with your application.

Methods

Function Class MethodDefine a column on the header level as expansion column

CL_SALV_COLUMNS_HIERSEQ

SET_EXPAND_COLUMN

Get current expansion GET_EXPAND_COLUMN

Page 26: Sub Objects of Alv Classes

columnHide position rows for all header rows

CL_SALV_HIERSEQ_LEVEL

SET_ITEMS_EXPANDED

Get current status of position rows

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.

        Hierarchy Column

The first column of the tree structure is always the hierarchy column. It is not part of the initial table. It contains symbols that the user can use to display or hide lower levels of a node. Using different icons, you are able to display whether a node is a branch with subnodes or a leaf.

By default the hierarchy column has no text. However, for each node, you are able to determine which text is to appear in the hierarchy column.

        Nodes

The actual entries in the tree structure are called nodes. Every node has the same structure as the initial table. Every node is uniquely identified by a key.

A node can either be a leaf or a branch: Branches contain either more branches or leaves that are not subdivided any further as subnodes.

        Item

Items are components of a node: Each node contains exactly as many items as are contained in the initial table. In this way you are able to compare items with the entries in a column.

Page 27: Sub Objects of Alv Classes

Based on the deviating data model, you are able to make some settings to the tree structures that are not available in the other ALV tools.

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

You are able to make the following settings for nodes:        Get node objects        Generate, move and delete nodes        Collapse and expand branches

You are able to make the following settings for items:        Determine value        Set Display of the Item        Set selectability

FeaturesFor all of the following functions, this is valid:

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Page 28: Sub Objects of Alv Classes

Get Node Object

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 Class MethodAll nodes together CL_SALV_TREE GET_NODESList of all node objects and their key

CL_SALV_NODES GET_ALL_NODES

Specific key GET_NODETop node GET_TOP_NODEList of all subnodes and their key

CL_SALV_NODE GET_SUBTREE

GET_CHILDRENGet key for the node GET_KEYRelated nodes GET_PARENT

GET_FIRST_CHILD

GET_LAST_CHILD

GET_PREVIOUS_SIBLING

GET_NEXT_SIBLING

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:

        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.

        One reference nodeEvery 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.

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

Page 29: Sub Objects of Alv Classes

Methods

Function Class MethodAdd nodes CL_SALV_NODE

SADD_NODE

Change top node SET_TOP_NODEMove node to another position within the tree structure

CL_SALV_NODE MOVE

Delete node with all of its subnodes DELETEDelete all nodes of the tree structure CL_SALV_NODE

SDELETE_ALL

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.

Methods

Function Class MethodDetermine text in the hierarchy column CL_SALV_NODE SET_TEXTGet current text in the hierarchy column 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.

Page 30: Sub Objects of Alv Classes

Methods

Function Class MethodSet icon for expanded branch CL_SALV_NOD

ESET_EXPANDED_ICON

Set icon for collapsed branch SET_COLLAPSED_ICONGet icon for expanded branch GET_EXPANDED_ICONGet icon for collapsed branch GET_COLLAPSED_ICON

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.

A node that is displayed as a branch although it contains no subnodes is also called an empty folder.

Methods

Function Class MethodInstead of displaying the icon for leaves, show the icon for a collapsed branch

CL_SALV_NODE SET_FOLDER

Check whether the node is an empty folder

IS_FOLDER

Display an expander in the empty folder

SET_EXPANDER

Check whether the empty folder has an 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 Class MethodExpand individual branch CL_SALV_NODE EXPANDCollapse individual branch COLLAPSEExpand all branches CL_SALV_NODES EXPAND_ALL

Page 31: Sub Objects of Alv Classes

Collapse all branches COLLAPSE_ALLChange visibility of a node CL_SALV_NODE SET_VISIBLECheck whether the node is visible

IS_VISIBLE

Change visibility of an item CL_SALV_ITEM SET_VISIBLECheck whether the item is 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 Class MethodChange content of a node CL_SALV_NOD

ESET_DATA_ROW

Get content of a node GET_DATA_ROWChange contents of an item

CL_SALV_ITEM SET_VALUE

Get content of an item GET_VALUE

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:

        Default        Text        Checkbox        Pushbutton        Link        IconFor 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 Class Method

Page 32: Sub Objects of Alv Classes

Set type of an item CL_SALV_ITEM SET_TYPEGet current type of the item GET_TYPEChange value of a checkbox SET_CHECKEDCheck value of a checkbox IS_CHECKEDEnable checkbox so that the user can change the value interactively

SET_EDITABLE

Check whether a checkbox is enabled

IS_EDITABLE

Insert icon SET_ICONGet icon GET_ICON

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

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 Class MethodSet selectability of an item CL_SALV_ITEM SET_ENABLEDCheck selectability IS_ENABLED

 Basic ALV Functions Sort         Filter        Perform Aggregations        Enable Layouts        Selection

Page 33: Sub Objects of Alv Classes

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:

        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 Class MethodGet SORTS object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

GET_SORTS

Get all sort objects

CL_SALV_SORTS GET

Get all sort objects for a

CL_SALV_HIERSEQ_LEVEL GET_SORTS

Page 34: Sub Objects of Alv Classes

hierarchy levelGet a specific sort object

CL_SALV_SORTS GET_SORT

Check whether a column is sorted (a sort object exists)

IS_SORT_DEFINED

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.

Methods

Function Class MethodCreate sort object CL_SALV_SORTS ADD_SORTDelete individual sort object REMOVE_SORTDelete all sort objects 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 Class MethodSet sort Direction CL_SALV_SORTS ADD_SORT (Parameter SEQUENCE)

CL_SALV_SORT SET_SEQUENCEGet sort direction CL_SALV_SORT 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.

Page 35: Sub Objects of Alv Classes

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 Class MethodChange column sequence of sorting

CL_SALV_SORTS ADD_SORT (Parameter POSITION)SET_POSITION

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.

Methods

Function Class MethodForbid changes to sort object CL_SALV_SORTS ADD_SORT

(Parameter OBLIGATORY)CL_SALV_SORT SET_OBLIGATORY

Check whether user is able to make changes to the sort object

CL_SALV_SORT IS_OBLIGATORY

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:

        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 Class MethodActivate grouping of the ALV output CL_SALV_SORTS SET_GROUP_ACTIVECheck whether grouping of the ALV output has been activated.

IS_GROUP_ACTIVE

Set display of control level change ADD_SORT (Parameter

Page 36: Sub Objects of Alv Classes

GROUP)CL_SALV_SORT SET_GROUP

Get display of the control level change

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

        The comparison value with which the rows are tested. This can be an individual value or an range for the given value.

        The condition, that is, an operator that defines the necessary relation between the cell value and the comparison value (for example, greater than, less than or equal to)

        Exclusion or inclusion, that is, whether the rows that fit the condition are to be displayed or whether they are not to be displayed

All entries that have the value AA in the CARRID column should be displayed.

Page 37: Sub Objects of Alv Classes

...

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:

        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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No 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

Page 38: Sub Objects of Alv Classes

Function Class MethodGet FILTERS object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

GET_FILTERS

Get all filter objects CL_SALV_FILTERS GETGet all filter objects for a hierarchy level

CL_SALV_HIERSEQ_LEVEL GET_FILTERS

Get specific filter object CL_SALV_FILTERS GET_FILTERCheck whether a column is filtered (a filter object exists)

IS_FILTER_DEFINED

Get all filter conditions for a filter object

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 Class MethodGenerate filter object CL_SALV_FILTERS ADD_FILTERDelete individual filter object

REMOVE_FILTER

Delete all filter objects CLEARGenerate filter condition CL_SALV_FILTER ADD_SELOPTDelete all filter conditions CLEARDetermine comparison value or area

CL_SALV_SELOPT SET_LOW

Page 39: Sub Objects of Alv Classes

SET_HIGHGet comparison value GET_LOW

GET_HIGHDefine condition (operator) SET_OPTIONGet condition (operator) GET_OPTIONDetermine inclusion or exclusion

SET_SIGN

Get inclusion or exclusion GET_SIGN

If you assign a new data table with a new structure to your ALV output, all filter objects will be deleted automatically.

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 Class MethodForbid filters for a column CL_SALV_FILTERS SET_FILTER_ALLOWEDCheck whether filters are forbidden for a column

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.

Page 40: Sub Objects of Alv Classes

Features

You are able to make the following settings for aggregations:

        General Settings for the Aggregation Object

        Settings for the Results Rows

        Settings for Intermediate Results

Make Settings for Aggregation

Use

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

        TotalAdds all values for the column

        MinimumDetermines the smallest value for the column

        MaximumDetermines the largest value for the column

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

Page 41: Sub Objects of Alv Classes

        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

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

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 Class MethodGet AGGREGATIONS object

CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_AGGREGATIONS

Get AGGREGATIONS object for a hierarchy level

CL_SALV_HIERSEQ_LEVEL GET_AGGREGATIONS

Get all aggregation objects CL_SALV_AGGREGATIONS GETGet a specific aggregation object

GET_AGGREGATION

Check whether a column will be calculated (has an aggregation object)

IS_AGGREGATION_DEFINED

Page 42: Sub Objects of Alv Classes

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 MethodCreate an aggregation object

CL_SALV_AGGREGATIONS ADD_AGGREGATION

Delete individual aggregation object

REMOVE_AGGREGATION

Delete all aggregation objects

CLEAR

Delete aggregation settings for an aggregation object

CL_SALV_AGGREGATION 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 Class MethodSet aggregation type CL_SALV_AGGREGATIONS ADD_AGGREGATION

(Parameter AGGREGATION)

CL_SALV_AGGREGATION SETGet aggregation type CL_SALV_AGGREGATION GET

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.

Page 43: Sub Objects of Alv Classes

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

        In columns that actually have a suitable data type, forbid aggregation

        In columns of data type numeric text, you expressly allow aggregation

Methods

Function Class MethodForbid aggregation in suitable columns

CL_SALV_AGGREGATIONS

SET_AGGREGATION_ALLOWED

Check whether aggregation is allowed in suitable columns

IS_AGGREGATION_ALLOWED

Allow aggregation in numeric text

SET_NUMERICAL_AGGREGATION

Check whether aggregation is allowed in numeric text

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

        Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions)

        Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)

Page 44: Sub Objects of Alv Classes

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 MethodDetermining the position of the results row

CL_SALV_AGGREGATIONS

SET_AGGREGATION_BEFORE_ITEMS

Check where the results rows are located

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:

        To specify in which column the values from which the intermediate results are calculated are located, generate an aggregation object for the desired column. The overall result is displayed in the results row.

        To specify which data records are contained in an intermediate result, group the data records: You sort the ALV output by the column that includes the criterion for the intermediate result.

        To then display the intermediate results, you calculate the intermediate results using the column with the criterion.

The most common way of generating intermediate results is to use subtotals. That is way you often find this term in place of intermediate results for all aggregation types. Nevertheless you can of course generate intermediate results (or “subtotals”) for all other aggregation types.

Page 45: Sub Objects of Alv Classes

Prerequisites

        You have generated an aggregation object for at least one aggregatable column.

        The column with the criterion for intermediate results is a column that cannot be aggregated.

        You are able to generate intermediate results for up to nine columns.

Features

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

        Generating Intermediate Results

        Hide Subvalues of Intermediate Results

        Determining the Position of the Results Row

        Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions)

        Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)

For all of the following functions, this is valid:

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No No

Generating Intermediate Results

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:

alphanumeric data typeor

Page 46: Sub Objects of Alv Classes

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 CL_SALV_SORTS ADD_SORT(Parameter SUBTOTAL)

CL_SALV_SORT SET_SUBTOTALCheck whether intermediate results are generated for a specific column

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 intermediate results

CL_SALV_SORTS SET_COMPRESSED_SUBTOTAL

Get column that only displays results rows

GET_COMPRESSED_SUBTOTAL

Check whether the rows for an intermediate result are hidden or displayed

CL_SALV_SORT IS_SUBTOTAL_COMPRESSED

 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.

Page 47: Sub Objects of Alv Classes

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:

The names of user-specific layouts start with a letter (A-Z). The names of layouts for all users start with '/'. The names of standard layouts provided by SAP start with a number (0-9).

Layout Key

All layouts for all applications are saved centrally. To enable a layout to be assigned to your application, set a layout key. All layouts that users save to your application can then be identified with this layout key and a name.

Features

You are able to make the following settings for layouts:

        Get layouts

        Set layout key

        Determine for whom users can save layouts

        Change layout for start of the ALV output

        Display dialog box for layout

The following is valid for all of these functions:

Display type

ALV Tool

Classic ABAP list

Full screen In the Container

Simple, two-dimensional table

Yes Yes Yes

Hierarchical-sequential Yes

Page 48: Sub Objects of Alv Classes

listTree structure Yes Yes

Get Layouts

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

Methods

Function Class MethodGet layout object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLECL_SALV_TREE

GET_LAYOUT

Get settings for individual layouts

CL_SALV_LAYOUT GET_LAYOUTS

Get current layout 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:

        Name of the application

        A key that uniquely identifies the output table within your application

        A logical group for further specification (for example with multiple ALV instances in one program)

Methods

Function Class MethodSet layout key CL_SALV_LAYOUT SET_KEYGet layout 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

        Only for themselves (user-specific)

        Only for other users (for all users)

Page 49: Sub Objects of Alv Classes

        For both themselves and for other users

Methods

Function Class MethodDetermine for whom users can save layouts

CL_SALV_LAYOUT SET_SAVE_RESTRICTION

Check for whom users can save layouts

GET_SAVE_RESTRICTION

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:

        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.

        You define a layout as initial layout. In this way, you override any defaults set up by the user.

Methods

Function Class MethodAllow defaults CL_SALV_LAYOUT SET_DEFAULTGet layout that was set by a user as a default

GET_DEFAULT_LAYOUT

Checks whether the user has set a layout as default

HAS_DEFAULT

Set initial layout SET_INITIAL_LAYOUTGet 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.

Methods

Function Class MethodDisplay dialog box CL_SALV_LAYOUT F4_LAYOUTS

Page 50: Sub Objects of Alv Classes

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:

        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 Class MethodGet selection object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_SELECTIONS

Get a selection object for a hierarchy level

CL_SALV_HIERSEQ_LEVEL GET_SELECTIONS

Page 51: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen In the Container

Simple, two-dimensional table

Yes Yes Yes

Hierarchical-sequential list

Yes

Tree structure No No

The following selection types are available:

        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 Classic ABAP ListHier.-Seq. List

Full screenContainer

Select individual column NONE NONESelect individual row SINGLE NONESelect individual cell NONE CELLSelect multiple cells(with CTRL or shift key)

Not possible CELL

Select one or multiple rows andone or more columns(with CTRL key)

SINGLE MULTIPLE

ROW_COLUMN

Page 52: Sub Objects of Alv Classes

CELLProvide pushbutton or checkbox to select rows

SINGLE ROW_COLUMN

CELL

Methods

Function Class MethodSet Selection Type CL_SALV_SELECTIONS SET_SELECTION_MODEGet selection type GET_SELECTION_MODE

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

Classic ABAP list

Full screen In the Container

Simple, two-dimensional table

No No No

Hierarchical-sequential list

No

Tree structure Yes Yes

Methods

Function Class MethodSet selectability of the item CL_SALV_ITEM SET_ENABLEDCheck whether the item can be selected

IS_ENABLED

Markierbarkeit des Knotens festlegen

CL_SALV_NODE SET_ENABLED

Check whether the node can be selected

IS_ENABLED

Select Area

You are able to set selections in the ALV output using your application.

Display type Classic ABAP list

Full screen In the Container

Page 53: Sub Objects of Alv Classes

ALV ToolSimple, two-dimensional table

Yes Yes Yes

Hierarchical-sequential list

Yes

Tree structure Yes Yes

Methods

Function Class MethodSet current cell CL_SALV_SELECTIONS SET_CURRENT_CELLGet current cell GET_CURRENT_CELLSelect cells SET_SELECTED_CELLSGet selected cells GET_SELECTED_CELLSSelect rows SET_SELECTED_ROWSGet selected rows GET_SELECTED_ROWSSelect columns CL_SALV_SELECTIONS

CL_SALV_SELECTIONS_TREE

SET_SELECTED_COLUMNSGet selected columns GET_SELECTED_COLUMNS

Select node CL_SALV_SELECTIONS_TREE SET_SELECTED_NODESGet selected nodes GET_SELECTED_NODESSelect item SET_SELECTED_ITEMGet selected item GET_SELECTED_ITEM

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:

        Defining Colors for Columns, Rows and Cells

        Setting Text Properties

        Hiding Lines Between Columns and Rows

Page 54: Sub Objects of Alv Classes

        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 Background Color

Technical Name

Black Standard DEFAULTBlack Light yellow EMPHASIZEDBlack Medium blue EMPHASIZED_ABlack Light blue EMPHASIZED_BBlack Salmon colored EMPHASIZED_CBlack Red EMPHASIZED_NEGATIVEBlack Green EMPHASIZED_POSITIVEGray Standard INACTIVEDark Blue Standard INTENSIFIEDDark Red Standard INTENSIFIED_CRITICAL

●      In both of the other tools you are able to change the combinations of text and background color to a certain degree:

○ You choose a color from a set of possible colors. ○ You determine whether this color is to be light or dark (intensity) ○ You determine whether the color applies to the background or the text (inverse display)

Page 55: Sub Objects of Alv Classes

Colors in List-Type ALV Outputs

Color Technical Name GUI-Dependent

COL_BACKGROUND

Gray Blue COL_HEADINGLight Gray COL_NORMALYellow COL_TOTALBlue Green COL_KEYGreen COL_POSITIVERed COL_NEGATIVEorange 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

Classic ABAP

List

Full Screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No No

Methods

Page 56: Sub Objects of Alv Classes

Function Class MethodChanging the Color of Columns

CL_SALV_COLUMN_LIST SET_COLOR

Get the color of a column

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

Classic ABAP

List

Full Screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Methods

Function Class MethodChange color combination for node

CL_SALV_NODE SET_ROW_STYLE

Get color combination for node

GET_ROW_STYLE

Change color combination for item

CL_SALV_ITEM SET_STYLE

Get color combination for item

GET_STYLE

Display Rows with Stripes

You are able to color the rows of the ALV output alternating light and dark.

The colors for both shades are defined by the system and you cannot change them.

Display Type

ALV Tool

Classic ABAP

List

Full Screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No No

Methods

Function Class Method

Page 57: Sub Objects of Alv Classes

Set striped pattern

CL_SALV_DISPLAY_SETTINGS

SET_STRIPED_PATTERN

Check whether the striped pattern is set

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:

        Set font

        Set alignment of the text in the column

        Determine lowercase and uppercase

        Determining display of empty cells

        Changing text color

Page 58: Sub Objects of Alv Classes

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:

        Standard font

        A non-proportional font (all characters require the same amount of space)

        A proportional font (characters have different widths)

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Methods

Page 59: Sub Objects of Alv Classes

Function Class Method

Set font of an item CL_SALV_ITEM SET_FONTGet font of an item GET_FONT

Set Alignment of the Text in the Column

You are able to set where the content of a column will be put:

        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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class Method

Set alignment of the column CL_SALV_COLUMN SET_ALIGNMENTGet alignment of the column GET_ALIGNMENT

Alignment in the Design Object

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

        Header

        Action information

        Label

        Text

Page 60: Sub Objects of Alv Classes

The alignment is only applicable when the following applies:

        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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class Method

Set alignment in the design object

CL_SALV_FORM_ACTION_INFOCL_SALV_FORM_HEADER_INFO CL_SALV_FORM_LABEL CL_SALV_FORM_TEXT

SET_HORIZONTAL_ALIGNMENT

Get alignment in the design object

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class Method

Convert lowercase letters to uppercase

CL_SALV_COLUMN SET_LOWERCASE

Check whether lowercase letters IS_LOWERCASE

Page 61: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class Method

Determine display of empty cells CL_SALV_COLUMN

SET_ZEROCheck how empty cells are to be displayed

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:

        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.

Page 62: Sub Objects of Alv Classes

Display type

ALV Tool

Classic ABAP list

Full screen In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes

(only horizontal)

Tree structure No No

Methods

Function Class MethodDisplay lines between rows CL_SALV_DISPLAY_SETTINGS SET_HORIZONTAL_LINESChecks whether lines between the rows are being displayed

IS_HORIZONTAL_LINES

Display lines between columns SET_VERTICAL_LINESChecks whether lines between the columns are being displayed

IS_VERTICAL_LINES

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

Classic ABAP list

Full screen In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes Tree structure Yes Yes

 Methods

Function Class MethodDisplaying Lines in the Design Object

CL_SALV_FORM_LAYOUT_GRID SET_GRID_LINES

Page 63: Sub Objects of Alv Classes

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:

        Number of decimal places

        Unit of measurement

        Currency

        Rounding

With each of these properties, you either move the decimal point the desired number of places (thus changing the value of the number) or you change the number of decimal places after the decimal point (the value of the number then stays the same). You are also able to combine two or more options.

You are able to apply each of the properties in two ways:

        You assign the desired property with a specific value to the column that contains the values to be displayed. Each of the values in the column is changed and displayed in the same way.

        You use a separate column that applies the desired property to individual rows of the ALV output. For more information, see Columns with Special Technical Significance, in the section called Control Columns That Are Assigned to a Column.

Features

You are able to make the following settings for numeric columns:

        Setting properties such as number of decimal places, units of measure, currency and rounding

        Displaying or hiding sign

        Hide or display leading zeros

        Determining Display of Empty Cells

The following is valid for all of these functions:

Display type

ALV Tool

Classic ABAP list

Full screen In the Container

Page 64: Sub Objects of Alv Classes

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes Tree structure 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 Class MethodDetermine number of decimal places

CL_SALV_COLUMN SET_DECIMALS

Get number of decimal places GET_DECIMALSDetermine unit of measure SET_CURRENCYGet unit of measure GET_CURRENCYDetermine currency SET_QUANTITYGet currency GET_QUANTITYDetermine rounding SET_ROUNDGet rounding 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 Class MethodDisplaying or hiding sign CL_SALV_COLUMN SET_SIGNChecks whether sign is being displayed or hidden

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 Classic ABAP Full screen In the

Page 65: Sub Objects of Alv Classes

ALV Tool

list Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes Tree structure Yes Yes

Methods

Function Class MethodHiding or Displaying Leading Zeros CL_SALV_COLUMN SET_LEADING_ZEROChecks leading zeros are being displayed or hidden

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:

        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

Classic ABAP list

Full screen

In the Container

Page 66: Sub Objects of Alv Classes

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class MethodSet column width CL_SALV_COLUMN SET_OUTPUT_LENGTH

Get column width GET_OUTPUT_LENGTH

Get column width of the referenced data element

GET_DDIC_OUTPUTLEN

Set Width of Hierarchy Column

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Methods

Function Class MethodSet whether the width of the hierarchy column is specified in characters or in pixels

CL_SALV_TREE_SETTINGS

SET_HIERARCHY_SIZE_IN_PIXEL

Check whether the width of the hierarchy column is specified in characters or in pixels

IS_HIERARCHY_SIZE_IN_PIXEL

Set width of hierarchy column

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.

Page 67: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class MethodOptimize individual column CL_SALV_COLUMN SET_OPTIMIZEDCheck whether a column is optimized

IS_OPTIMIZED

Optimize all columns simultaneously

CL_SALV_COLUMNS SET_OPTIMIZE

Check whether all columns are optimized

IS_OPTIMIZED

In the printout, the columns that are output are exactly as wide as they are on the screen by default. In the full-screen display of a simple, two-dimensional table, you are able to determine that the column widths be optimized in the printout. To do this, use the method SET_COLUMN_OPTIMIZATION in the CL_SALV_PRINT class. With the IS_COLUMN_OPTIMIZATION you check whether the columns are optimized in the printout.

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.

Page 68: Sub Objects of Alv Classes

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes No NoHierarchical-sequential list Yes    Tree structure   No No

Methods

Function Class MethodArranging values in multiple rows

CL_SALV_COLUMN SET_ROW

Get rows in which the data is being displayed

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:

        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

Classic ABAP list

Full screen

In the Container

Page 69: Sub Objects of Alv Classes

Simple, two-dimensional table Yes Yes NoHierarchical-sequential list Yes    Tree structure   No No

Display ALV Output in a Dialog Box

You display the ALV output in the dialog box by specifying the position of the dialog box on the screen. This is measured in columns and rows of characters: each character corresponds in width to one column, in height to one row.

You specify the distance between the dialog box and the left side of the screen in columns and from the top of the work area in rows.

Methods

Function Class MethodDisplay ALV output in a dialog box

CL_SALV_TABLECL_SALV_HIERSEQ_TABLE

SET_SCREEN_POPUP(Parameter START_COLUMN bzw.START_LINE)

Get position of the dialog box

GET_SCREEN_POPUP

Specify the Size of the Dialog Box

You specify the size of the dialog box only indirectly:

Page 70: Sub Objects of Alv Classes

        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

        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 Class MethodSpecify the Size of the Dialog Box

CL_SALV_TABLECL_SALV_HIERSEQ_TABLE

SET_SCREEN_POPUP(Parameter END_COLUMN bzw. END_LINE)

Specify the size of the dialog box

GET_SCREEN_POPUP

 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.

Page 71: Sub Objects of Alv Classes

        You provide Pushbuttons or Menu Entries for generic ALV functions or define your own application-specific functions

        In the columns of the ALV output, you provide elements for interaction such as pushbuttons, checkboxes or hyperlinks

        You process the user’s 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:

        Generic ALV FunctionsYou are able to enables these functions independent of the objectives of your application. Generic ALV functions are sorting, filtering, managing layouts, printing, and so on.

        Custom Application-Specific FunctionsYou use your application to provide functions that are specially customized to the requirements of this application. In the ALV output, you make pushbuttons available with which users can trigger the function.

Screen Status

When you display a tree structure or a simple, two-dimensional table in a container, simply specify your desired functions with the appropriate setter method.

In the following display types, on the other hand, ALV controls the entire screen:

        Simple, two-dimensional table in full screen

        Hierarchical-sequential list

        Tree structure in the full screen

Page 72: Sub Objects of Alv Classes

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:

        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:

        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

        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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes NoHierarchical-sequential list Yes    Tree structure   Yes No

Methods

Function Class MethodSet screen status CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

SET_SCREEN_STATUSGet screen status GET_SCREEN_STATUS

Page 73: Sub Objects of Alv Classes

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

        BEFORE_SALV_FUNCTIONThe event takes place before the function is executed

        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:

        In container display (simple, simple two-dimensional table or tree structure) you are not able to change the sequence of the pushbuttons.

        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.

Page 74: Sub Objects of Alv Classes

You are only able to set a function as a menu entry using the screen status. In the container display you are not able to influence the menu structure.

Function Groups

You are able to enable or disable every generic ALV function. Most generic ALV functions however, are part of groups of functions that have been grouped together logically. In this way, you are able to enable all of the functions for this group with one command.

Features

You are able to make the following settings for generic ALV functions:

        Get function settings

        Enable generic ALV functions

        Check visibility and activation status of a self-defined function

The following is valid for all of these functions:

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-Sequential List Yes    Tree structure   Yes Yes

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 hierarchical-sequential 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 Class MethodGet FUNCTIONS object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

GET_FUNCTIONS

Page 75: Sub Objects of Alv Classes

CL_SALV_TREEGet all function objects CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

GET_FUNCTIONSCheck whether a function is a generic ALV function

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

        You enable a function group. All of the functions for this function group are enabled simultaneously

        You enable all generic ALV functions simultaneously

In the list-type ALV outputs (simple, two-dimensional table and hierarchical-sequential list), there is also a preset default selection of the most frequent generic ALV functions.

Methods

Function Class MethodEnable individual generic ALV functions

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

SET_<generic ALV function>

Enable function group

SET_GROUP_<Function group>

Enable all generic ALV functions

SET_ALL

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.

Page 76: Sub Objects of Alv Classes

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 Class MethodCheck visibility CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

IS_VISIBLECheck activation status 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.

Page 77: Sub Objects of Alv Classes

●      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 hierarchical-sequential 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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class MethodGet FUNCTIONS object CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

CL_SALV_TREE

GET_FUNCTIONS

Page 78: Sub Objects of Alv Classes

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:

●      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 self-defined 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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No YesHierarchical-sequential list No    Tree structure   No Yes

Methods

Function Class MethodCreate and display a function object for a self-defined function

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

ADD_FUNCTION

Delete function object REMOVE_FUNCTIONCheck whether a function object already exists

IS_ITEM

Set text for a pushbutton ADD_FUNCTION(Parameter TEXT)

Set icon for a pushbutton ADD_FUNCTION(Parameter ICON)

Set position within the application toolbar

ADD_FUNCTION(Parameter POSITION)

Set tooltip for the pushbutton

ADD_FUNCTION(Parameter TOOLTIP)

Page 79: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

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

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No YesHierarchical-sequential list No    Tree structure   No Yes

Methods

Function Class MethodShow or hide a self-defined function

CL_SALV_FUNCTIONS_LIST

CL_SALV_FUNCTIONS_TREE

SET_FUNCTION

Check visibility IS_VISIBLEEnable / disable a self-defined function

ENABLE_FUNCTION

Check activation status 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

Classic ABAP list

Full screen

In the Container

Page 80: Sub Objects of Alv Classes

Simple, two-dimensional table No No YesHierarchical-sequential list No    Tree structure   No Yes

Methods

Function Class MethodInstead of a self-defined function, execute a generic ALV function

CL_SALV_TABLECL_SALV_TREE

SET_FUNCTION

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:

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

        PushbuttonYou are able to handle user actions on this element with an event.

        HyperlinkYou specify the Internet addresses (URLs). Users can then call up the corresponding page in the Internet browser by clicking on one of these Internet addresses.

        Click AreaYou are able to handle user actions on this element with an event.

In list-type ALV outputs, the setting for interactive elements is called cell type. In tree structures it is called type of item.

Features

You are able to make the following settings for interactive elements:

        Get current setting

        Assign cell type or type of item

Page 81: Sub Objects of Alv Classes

Get Current Setting

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

        All cells of a column get the same cell type. Here the cell type is thus a property of the column.

        Using a column for cell types, you assign any cell type to each of the individual rows.

In the tree structures, on the other hand, the type is a property of the item.

Depending on of what the cell / item type is a property, you proceed differently to obtain the current settings.

Methods

Function Class MethodGet the property of a column

CL_SALV_TABLE GET_COLUMNS

Check whether a column exists for cell types

CL_SALV_COLUMNS_LIST GET_CELL_TYPE_COLUMN

Get the cell type of a column

CL_SALV_COLUMN_LIST GET_CELL_TYPE

Get properties of an item

CL_SALV_TREE GET_NODESCL_SALV_NODES GET_NODECL_SALV_NODE GET_ITEM

GET_HIERARCHY_ITEMCL_SALV_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 Class MethodDisplay element in a cell CL_SALV_COLUMN_LIST SET_CELL_TYPEDisplay element in an item CL_SALV_ITEM SET_TYPE

Page 82: Sub Objects of Alv Classes

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 hierarchical-sequential list, however, you are not able to activate the checkboxes, which means the user is not able to change the value of a checkbox.

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:

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

Page 83: Sub Objects of Alv Classes

○ 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 Cell Type Value of the Cell

Checkbox enabledIndicator not set

CHECKBOX_HOTSPOT

’0’ or ’ ’

Checkbox enabledIndicator set

CHECKBOX_HOTSPOT

’1’ or ’X’

Checkbox disabledIndicator not set

CHECKBOX ’0’ or ’ ’

Checkbox disabledIndicator set

CHECKBOX ’1’ or ’X’

  Checkbox hidden CHECKBOX

CHECKBOX_HOTSPOT

’-’

Features

You are able to make the following settings for checkboxes:

●      Display checkbox (assign cell and item type)

●      Enable/disable checkbox in the item

●      Set/remove indicator for the checkbox in the item

Checkbox Display

●      To display a disabled checkbox in a list-type ALV output, use the cell type CHECKBOX.

●      To display an enabled checkbox in the simple, two-dimensional table (full screen or container), use the cell type CHECKBOX_HOTSPOT.

●      To display a checkbox in a tree structure, use the type of item CHECKBOX

Page 84: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Methods

Function Class MethodEnable checkbox CL_SALV_ITE

MSET_EDITABLE

Check whether the checkbox is enabled

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 No No NoHierarchical-sequential list No    Tree structure   Yes Yes

Methods

Function Class MethodSet the indicator for the checkbox

CL_SALV_ITEM

SET_CHECKED

Page 85: Sub Objects of Alv Classes

Check whether the indicator for the checkbox is set

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No YesHierarchical-sequential list No    Tree structure   Yes Yes

If users select a pushbutton, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_TREE)

...

Features

You are able to make the following settings for pushbuttons:

        Display pushbutton (assign cell and item type)

Display the Pushbutton

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

        To display a pushbutton in a tree structure, use the type of item BUTTON.

Page 86: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No No

Features

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

        Get hyperlink objects

        Create, change and delete hyperlink objects

        Display Internet Address

        Define Internet address as click area (assign cell type)

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.

Page 87: Sub Objects of Alv Classes

Methods

Function Class MethodGet hyperlinks CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

GET_FUNCTIONAL_SETTINGS

Get all hyperlink objects

CL_SALV_FUNCTIONAL_SETTINGS

GET_HYPERLINKS

CL_SALV_HYPERLINKS GETGet a specific hyperlink object

CL_SALV_HYPERLINKS GET_HYPERLINK

Get Internet address

CL_SALV_HYPERLINK GET_HYPERLINK

Get key 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 Class MethodCreate hyperlink object

CL_SALV_HYPERLINKS

ADD_HYPERLINK

Delete individual hyperlink object

REMOVE_HYPERLINK

Delete all hyperlink objects

CLEAR

Change hyperlink object (address)

CL_SALV_HYPERLINK SET_HYPERLINK

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.

Page 88: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   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)

...

Features

You are able to make the following settings for click areas:

        Display click area (assign cell and item type)

Click Area Display

        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.

Page 89: Sub Objects of Alv Classes

Handling Single and Double Clicks 

Use

Usually the user selects areas in the ALV output, by clicking - and perhaps also pressing CTRL or shift - in the ALV output.

You are also able to determine which functions will be started when the user performs the following mouse actions:

        Single click on a cell or an item of the ALV output

        Double click on a cell or an item of the ALV outputor alternativelySelecting 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:

        Functions for single click

        Functions for Double Click or F2

The following is valid for all of these functions:

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Functions for Single Click

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:

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

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

Page 90: Sub Objects of Alv Classes

        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:

        You register your application for the event DOUBLE_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE)or

        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 Class MethodSet function code CL_SALV_FUNCTIONAL_SETTING

SSET_F2_CODE

Get function 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:

        F1 Function Key The user calls a help text for the selected column using the F1 function key.

        F2 Function Key This key is always an alternative to double clicking. You determine which function is triggered when the user double clicks or presses F2.  You cannot change its meaning.

        F4 function keyWith 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:

Page 91: Sub Objects of Alv Classes

        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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table No No NoHierarchical-sequential list No    Tree structure   Yes Yes

You proceed in two steps:

        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.

        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:

        F1 function key

        F4 function key

        Remove

        Enter key

        Insert

        Control plus X

        Control plus C

        Control plus V

Page 92: Sub Objects of Alv Classes

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 Class MethodRegister the key for an event

CL_SALV_EVENTS_TREE

ADD_KEY_FOR_KEYPRESS

Delete entire list of keys that trigger the event

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:

        F1 HelpFor 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.

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

        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.

        For physically impaired users, especially blind or visually impaired ones, the tooltip texts are read aloud using screen reader technology.

You are able to define tooltips for the following elements of your ALV output:

        For column headers

Page 93: Sub Objects of Alv Classes

        For functions in the application toolbar

        For colors, exceptions and symbols

        For elements in the design object

Depending on the element for which you want to define a tooltip, you proceed differently.

Features

You are able to make the following settings for tooltips:

        Tooltip Object Management and Generation for Colors, Exceptions and Symbols

        Generation of Tooltips for Column Headers

        Generation of Tooltips for Functions

        Generation of Tooltips for Icons and Symbols

        Generation of Tooltips for Elements in the Design Object 

Tooltip Object Generation and Management 

Use

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

        Symbols

        Exceptions

        Colors of cells

You use tooltip objects when the element to which the tooltip belongs can appear multiple times: to ensure that the same tooltip text is displayed every time, when an element is displayed assign a specific tooltip object to the element.

The color green always means Released. In order to always display exactly this text as tool tip when a row is green, assign the appropriate tooltip to the color.

The tooltip object contains the following information:

        The type of tooltip object (that is for which element the tooltip can be sued)

Page 94: Sub Objects of Alv Classes

        The indicator for the element

        The text that is displayed as tooltip

Features

You are able to make the following settings for tooltip objects:

        Get tooltip object

        Create, change and delete tooltip object

The following is valid for all of these functions:

Display type

ALV Tool

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Get Tooltip ObjectIn 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 Class MethodGet tooltips CL_SALV_TABLE

CL_SALV_HIERSEQ_TABLE

GET_FUNCTIONAL_SETTINGS

CL_SALV_TREE GET_TREE_SETTINGSGet all tooltip objects

CL_SALV_FUNCTIONAL_SETTINGS

GET_TOOLTIPS

CL_SALV_TREE_SETTINGSCL_SALV_TOOLTIPS GET

Get specific tooltip object

CL_SALV_TOOLTIPS GET_TOOLTIP

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.

Page 95: Sub Objects of Alv Classes

Methods

Function Class MethodGet tooltip object 

CL_SALV_TOOLTIPS 

ADD_TOOLTIP

Delete individual tooltip object

REMOVE_TOOLTIP

Delete all tooltip objects

CLEAR

Change the text for the tooltip object

CL_SALV_TOOLTIP SET_TOOLTIP

Get the text for the tooltip object

GET_TOOLTIP

Get type of tooltip GET_TYPEGet indicator for element

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.

Page 96: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   Yes Yes

Methods

Function Class MethodUse an F1 help text from another DDIC element

CL_SALV_COLUMN

SET_F1_ROLLNAME

Get name of the DDIC element from which the F1 help text has been taken

GET_F1_ROLLNAME

Page 97: Sub Objects of Alv Classes

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

Classic ABAP list

Full screen

In the Container

Simple, two-dimensional table Yes Yes YesHierarchical-sequential list Yes    Tree structure   No No

Of course the user is also able to print a tree structure. However, you cannot make settings for the printout here with the ALV object model.

No matter which display type you use to display the ALV output on the screen: in the printout, the ALV output is converted to the classic ABAP list (or to a list in the style of the ABAP list) and is printed in this form.

Features

You can make the following settings for the printout of the ALV output:

        Output additional information

        Output standard title of the program

        Determine that the ALV be called in print mode

        Take actual list size into consideration during printing

        Optimize Column Width in the Printout

        Reserve Rows for Event END_OF_PAGE

Output Additional Information

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

Page 98: Sub Objects of Alv Classes

        List informationInformation 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.

        Selection informationInformation 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 MethodOutput of list information

CL_SALV_PRINT SET_LISTINFO_ON

Check whether list information are being output

IS_LISTINFO_ON

Output selection information

SET_SELECTIONINFO_ON

Check whether selection information is being output

IS_SELECTIONINFO_ON

Output additional information on a separate page

SET_COVERPAGE_ON

Check whether additional information is being printed on a separate page

IS_COVERPAGE_ON

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.

Methods

Function Class MethodOutput standard title of the CL_SALV_PRINT SET_REPORT_

Page 99: Sub Objects of Alv Classes

program STANDARD_HEADER_ON

Determine that the ALV Be Called in Print Mode

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

Methods

Function Class MethodPrint ALV output directly CL_SALV_PRIN

TSET_PRINT_ONLY

Check whether ALV output is being printed directly

IS_PRINT_ONLY

Take Actual List Size into Consideration During PrintingYou 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 Class MethodTake actual list size into consideration during printing

CL_SALV_PRINT SET_PRINT_PARAMETERS_ENABLED

Check whether the list size can be adapted

IS_PRINT_PARAMETERS_ENABLED