Sub Objects of Alv Classes
Sub Objects of Alv Classes
main ALV classes. The following table shows which methods in the main ALV classes provide which subobjects: Methods of Main ALV Classes to Get Subobjects Method GET_AGGREGATIONS GET_COLUMNS Returns Object of Type CL_SALV_AGGREGATIONS CL_SALV_COLUMNS_TABLE or CL_SALV_COLUMNS_HIERSEQ or CL_SALV_COLUMNS_TREE CL_SALV_DISPLAY_SETTINGS CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE CL_SALV_FILTERS CL_SALV_FUNCTIONAL_SETTINGS CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE CL_SALV_LAYOUT CL_SALV_HIERSEQ_LEVEL CL_SALV_NODES CL_SALV_PRINT CL_SALV_SELECTIONS CL_SALV_SELECTIONS_TREE CL_SALV_SORTS CL_SALV_TREE_SETTINGS Remarks
GET_DISPLAY_SETTINGS GET_EVENT
Not in CL_SALV_TREE
GET_FILTERS GET_FUNCTIONAL_SETTIN GS GET_FUNCTIONS GET_LAYOUT GET_LEVEL GET_NODES GET_PRINT GET_SELECTIONS GET_SORTS GET_TREE_SETTINGS
Not in CL_SALV_TREE Not in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE Only in CL_SALV_HIERSEQ_TABLE Only in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE Not in CL_SALV_TREE Only in CL_SALV_TREE
If one of the classes uses another class, you can also get its objects using the Get methods. Class Used CL_SALV_AGGREGATIONS CL_SALV_COLUMNS_TABLE CL_SALV_COLUMNS_HIERSEQ CL_SALV_COLUMNS_TREE CL_SALV _FUNCTIONAL_SETTINGS CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE CL_SALV_FILTERS CL_SALV_NODES CL_SALV_SORTS Includes Get method Returns Object of Type GET_AGGREGATION CL_SALV_AGGREGATION GET_COLUMN CL_SALV_COLUMN
CL_SALV_TREE_SETTINGS
Methods Function Change Font Size of the Title Get current font size Class Method CL_SALV_DISPLAY_SETTINGS SET_LIST_HEADER_SIZE GET_LIST_HEADER_SIZE
Columns
ALV is only able to determine a part of the possible column properties. These are mainly the technical descriptions such as internal length, internal type and so on. With the methods for class CL_SALV_COLUMN (or its subclasses), you define more properties as needed. The following graphic shows the inheritance hierarchy of a column object:
Column Types
You are able to differentiate between the following column types: y Standard columns y Lead columns, which are columns that have a special textual meaning in your ALV output. y Special columns that control the meaning or display of other columns or that are reserved for special functions Some of the settings that you make for a column are valid for all of these column types, but some are only reserved for a specific type of column.
Use You are able to make the following settings for all columns.
y y y y y y y y
Set the visibility of the column Change Position of the Column within the ALV Output Change Column Header Columns with Special Meaning Lead Columns Setting the Properties of Text in the Column Determining Appearance Determining Width of a Column
Get Column Objects The GET_COLUMNS method exists in each ALV main class. It returns the column descriptions of all columns in the ALV output (all column objects). You use this object (class CL_SALV_COLUMNS) and the GET method or GET_COLUMN methods to get the desired column description.
Methods Function Get all column objects Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_COLUMNS GET CL_SALV_HIERSEQ_LEVEL GET_COLUMNS CL_SALV_COLUMNS CL_SALV_COLUMN CL_SALV_ITEM CL_SALV_AGGREGATION CL_SALV_SORT GET_COLUMN GET_COLUMNNAME Method GET_COLUMNS
Get all column objects for a hierarchy level Get specific column object Get technical name of the current column
For columns that you have defined as lead columns, you are able to determine whether the user can hide them or not. y You are able to determine which columns should not be included in the user's column set: You define the column as a technical column. Most columns with special technical meaning are automatically technical columns and thus are not included in the users column set. Methods Function Set the visibility of a column Check setting for visibility Define column as technical column Check whether column is a technical column Class Method CL_SALV_COLUMN SET_VISIBLE IS_VISIBLE SET_TECHNICAL IS_TECHNICAL
Change Position of the Column within the ALV Output The exception column is always displayed as the first column. You cannot change its position.
GET_COLUMN_POSITION
Methods Function Get name of the DDIC data element Get DDIC data type Get DDIC decimal places Get DDIC domains Get output length according to DDIC (CHAR) Class Method CL_SALV_COLUMN GET_DDIC_ROLLNAME GET_DDIC_DATATYPE GET_DDIC_DECIMALS GET_DDIC_DOMAIN GET_DDIC_OUTPUTLEN
If a column does not have a DDIC reference, you are able to retrieve the following properties:
y y Internal length To do this, use the method GET_DDIC_INTLEN Internal type To do this, use the method GET_DDIC_INTTYPE
Change DDIC Reference of an Individual Column or of Multiple Columns You are able to create or change the DDIC reference for one or more columns. If multiple columns of your ALV output have the same name as the fields in a DDIC structure that already exists, you assign the entire DDIC structure to your ALV output. Columns with the same name get the properties of the corresponding fields of the DDIC structure.
Methods Function Change DDIC reference for an individual column Get DDIC reference for the column Change DDIC reference for several columns Class CL_SALV_COLUMN Method SET_DDIC_REFERENCE GET_DDIC_REFERENCE CL_SALV_COLUMNS APPLY_DDIC_STRUCTURE
Column Header
The column header displays the name of a column for the user. You are able to define three different texts as column header. Use You are able to make the following settings for the column header:
y Determine wording of the column header y Display or hide column header y Determine whether the user can sort the table according to this column by clicking on the column header y Determine tooltip for the column header y Display an icon (only tree structure)
Determine Wording of the Column Header You can specify three different variants of the column header: The long, medium and short column header. If the user changes the column width, the column header that fits the column best is automatically used. A special case is the column header of the hierarchy column in the tree structure: Because there is no COLUMN object for this column, you determine this column header using the properties of the tree structure.
Methods Function Determine version of the column header Class CL_SALV_COLUMN Method SET_LONG_TEXT SET_MEDIUM_TEXT SET_SHORT_TEXT GET_LONG_TEXT GET_MEDIUM_TEXT GET_SHORT_TEXT Determine column CL_SALV_TREE_SETTINGS SET_HIERARCHY_HEADER header of the hierarchy column of a tree structure Get column header of GET_HIERARCHY_HEADER the hierarchy column of a tree structure
Display or Hide Column Header
Methods Function Display or hide column header Check whether column headers are being displayed or hidden
Sort by Clicking on Column Header You are able to determine that the column header serve as a pushbutton for sorting the table. The sort direction is then indicated as a small arrow pointing up or down.
Methods Function Set column header as pushbutton for sorting the table Check whether column header is set as pushbutton for sorting the table Class Method CL_SALV_ SET_SORT_ON_ FUNCTIONAL_SETTINGS HEADER_CLICK IS_SORT_ON_ HEADER_CLICK
Determine Tooltip for the Column Header You are able to define a text that will be displayed when the user rests the mouse pointer on the column header for a moment. The tooltip for the hierarchy column in the in the tree structure is a special case: Because there is no COLUMN object for this column, you determine this tooltip using the properties of the tree structure.
Methods Function Determine tooltip for the column header Get current tooltip for a column header Set tooltip for hierarchy column of a tree structure Get tooltip for hierarchy column of a tree structure Get all tooltip objects for column headers of the tree structure
Display Icon In the column header of the hierarchy column for a tree structure, you can display an icon.
Class Method CL_SALV_COLUMN SET_TOOLTIP GET_TOOLTIP CL_SALV_ TREE_SETTINGS SET_HIERARCHY_TOOLTIP GET_HIERARCHY_TOOLTIP GET_TOOLTIPS
Methods Function Display icon in the column header of the hierarchy column ?? Get icon currently being displayed Class Method CL_SALV_ SET_HIERARCHY_ICON TREE_SETTINGS GET_HIERARCHY_ICON
Lead Columns
Columns that have already been designated by the application as primary key automatically become lead columns in the ALV object model. The following properties differentiate a lead column from a normal column:
y Lead columns have a different color. This color is determined by the system. y You are able to determine whether a lead column moves when you scroll sideways through the screen like the other columns, or whether it stays where it is. y Lead columns can be found in the users column set. By default, the user is able to hide lead columns. You are able to prevent users from hiding lead columns.
Use You are able to make the following settings for lead columns:
y y y y
Define the column as a lead column Determine the color of individual cells in the lead columns Prevent lead columns from scrolling Prevent lead columns from being hidden
Defining the Column as a Lead Column You are able to define any column of the ALV output as a lead column.
Methods
Function Class Method
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
Prevent Lead Columns from Scrolling If there is not enough room for all of the columns of the ALV output to be displayed on the screen simultaneously, the user can scroll sideways until the desired column becomes visible. Usually the other columns disappear when you are doing this. You are able to determine whether the lead columns are fixed, which means that they remain visible when you scroll sideways.
Methods
Function Class Method
Fix lead columns Checks whether the lead columns are fixed
Preventing Lead Columns from Being Hidden By default, users can hide or display columns that are part of their column set as needed. You are able to prevent users from hiding each lead column individually.
Methods
Function Class Method
Prevent lead columns from being hidden Check whether the lead column can be hidden
Control columns These columns are technical columns, which means they are usually not displayed. They contain information on how the contents are being displayed in another column. Examples of control columns are:
y y Color column (technical column) Currency column (visible column)
Many of the properties that you assign to specific cells using control columns can also be assigned to a whole column (for example assigning a currency to a whole column).
Graphic columns To display icons, exceptions and symbols, you use specific notation (for example @AB@). So that these character strings are interpreted as IDs for a graphic and not as text, you define the column accordingly as an icon-, exception or symbol column. Columns with special function These columns include functions that are only useful in very specific situations. Examples of these columns include:
y y y Use Depending on how you use a special column, you need to be aware of different things. Using Control Columns With control columns you assign specific properties to one or more cells. Expansion column for the hierarchical-sequential list Text Column for Labels in Results Rows for Intermediate Results Counter Column to Determine the Number of Rows
An entry in the control column always refers to cells from those rows that include the entry as well. There are two types of control columns: Control columns that are fixed and assigned to a specific column. Control Columns That Contain Information for Any Number of Columns
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.
Control column Currency column Column for decimal places Column for units of measure Rounding column
Class Method CL_SALV_COLUMN SET_CURRENCY_COLUMN GET_CURRENCY_COLUMN SET_DECIMALS_COLUMN GET_DECIMALS_COLUMN SET_QUANTITY_COLUMN GET_QUANTITY_COLUMN SET_ROUND_COLUMN GET_ROUND_COLUMN
In hierarchical-sequential lists you also have to specify in which of the two hierarchy columns the control column is located. To do this, use one of the SET_*_COLUMN_LEVEL methods in the class CL_SALV_COLUMN_HIERSEQ. Control Columns That Contain Information for Any Number of Columns
The cells of this control column contain whole tables: Each of these tables exclusively refers to cells in the same row of the ALV output. If this table contains multiple rows, each of these rows controls a specific column of the ALV output. Every row then contains the name of the column in the ALV output to which the settings refer (in the graphic below, rows 1 and 2). If no column name is specified, all columns of the ALV output get the settings (in the graphic below, row 3).
For this type of control columns, use the following methods: Control column Column for cell types Color column Hyperlink column Class Method CL_SALV_COLUMNS_LIST SET_CELL_TYPE_COLUMN GET_CELL_TYPE_COLUMN SET_COLOR_COLUMN GET_COLOR_COLUMN SET_HYPERLINK_ENTRY_ COLUMN GET_HYPERLINK_ENTRY_ COLUMN SET_DROPDOWN_ENTRY_ COLUMN GET_DROPDOWN_ENTRY_ COLUMN
Dropdown column
In the tree structure you are able to assign colors to nodes or to an individual item. Use Graphic Column In list-type ALV outputs, you are only able to display icons or symbols in columns that are specifically defined for this purpose. They may only contain entries that uniquely identify an icon or symbol in your system.
In the tree structure you can display an icon in any item. To do this, use the method SET_ICON in the CL_SALV_ITEM class.
Methods Function Defining the column as a icon column Check whether the current column is an icon column Define the column as a symbol column Check whether the current column is an symbol column
Exception Column
The exception column is a special form of the graphic column: It displays a status of the current data record with specific icons. The most common display of exception icons is the traffic light: You can display, release status, for example, with these icons. As opposed to regular graphic columns, the exception column has additional properties: The values in the exception column must be between 1 and 5 It can only display a specific set of icons. You are able to choose the icons you wish to display from several exception groups. In the exception column itself, only the values allowed in this exception group are available Users cannot hide the exception column In list-type ALV outputs, the exception column is always displayed as the first column Methods Function Specify exception column Get exception group Class CL_SALV_COLUMNS_LIST Method SET_EXCEPTION_COLUMN the
Results rows from aggregations remain empty in the exception column by default. In list-type ALV outputs, however, you are able to display exception icons. To do this, in the class CL_SALV_COLUMNS_LIST, use the method SET_EXCEPTION_COLUMN (Parameter CONDENSED). You check whether the results row is displaying an exception icon using the method IS_EXCEPTION_CONDENSED or GET_EXCEPTION_SETTINGS (Parameter CONDENSED).
You cannot use every exception group in every representation type of the simple, twodimensional table or hierarchical-sequential list. The following table shows where you can use which exception group. Exception Group Icon Representation Classic ABAP List Yes No No No No No No Full screen Containers Hierarch.Seq. List Yes No No No No No No
1 2 3 4 5 6 7
Yes No No No No No No
Columns with Special Function With some special columns, you control functions that are only useful in very specific situations.
Expansion Column
This column is only available in the hierarchical-sequential list. You use it to specifically display and hide position rows for specific headers. Here you only check whether an entry in a row of this column is included: if the cell is empty, only the position rows for the associated header are displayed. If the cell gets a value, the position rows for the associated header are hidden.
Methods Function Define expansion column Get current expansion column Class Method CL_SALV_COLUMNS_HIERSEQ SET_EXPAND_COLUMN GET_EXPAND_COLUMN
You are able to display intermediate results for aggregations. These intermediate results are displayed in a special results row in the column the values of which are used in the aggregation. All other columns in this row are empty by default. You are able to specify a column the values of which are also transferred to the results row.
Methods Function Define text column Get current text column Class Method CL_SALV_COLUMN_LIST SET_TEXT_COLUMN GET_TEXT_COLUMN
You are able to determine and output the number of data records of the ALV output. To do this, you need a special column, the count column. The rows of this count column never display data. The results row, however, contains the number of data records. Methods Function Define count column Get count column Class Method CL_SALV_COLUMNS_LIST SET_COUNT_COLUMN GET_COUNT_COLUMN
y y y
Design Object Compilation Displaying a Design Object at Top or Bottom of the Whole ALV Output Displaying a Design Object in Multiple Page ALV Outputs on Every Page
You are able to use the following element types: Header element (header info) Text element with or without label (text label) Action information The elements only differ in appearance. No functions are linked to the various element types.
Layout Forms
You can arrange these elements within your design object. To do this, you choose between two layout forms: Row-type layout All elements are lined up in a row. Table-type layout You arrange the individual elements in rows and columns.
You are able to combine the two layout forms with one another as you wish, that is, you can insert rows into a table and vice versa.
Restrictions
For Top of List, Top of Page, and End of Page a design object is not allowed to be more than one page long. If the design object is longer than one page, a runtime error occurs or the display of the ALV output is negatively affected in some other way, depending on the position of the design object. For End of List, there is no restriction on length.
For the Top of List design object, you can activate a special mode that makes it possible to wrap text within the design object. For more information, see Display List Header and Footer.
By default, a page is 65 lines long. Ensure that the design object contains fewer than 65 lines. Integration A class is available for each element type:
Classes of Element Types and Layouts Layout Row-type layout Table-type layout Class CL_SALV_FORM_LAYOUT_FLOW CL_SALV_FORM_LAYOUT_GRID
Depending on the number of elements in your design object, you proceed differently:
If you only want to display one element, generate the associated object. If you want to display multiple elements, generate the desired elements with the methods for the row- or table-type layout element and specify the desired position within the layout element.
Features Layout The following functions are available for the layout forms:
Methods Function Generate an element of the desired type Move element Count elements Class Method CL_SALV_FORM_LAYOUT_ CREATE_* FLOW CL_SALV_FORM_LAYOUT_ SET_ELEMENT GRID GET_ELEMENT_COUNT
Link cells
Show lines between columns and rows Get number of columns and rows Specify which column contains the labels and which column contains the associated texts Add rows
Element Types
ADD_ROW
Methods Function Enter text Enter tooltip Specify alignment within a cell Class CL_SALV_FORM_ACTION_INFO Method SET_TEXT SET_TOOLTIP CL_SALV_FORM_HEADER_INFO SET_HORIZONTAL_ ALIGNMENT CL_SALV_FORM_LABEL GET_HORIZONTAL_ CL_SALV_FORM_TEXT ALIGNMENT CL_SALV_FORM_LABEL SET_LABEL_FOR GET_LABEL_FOR
The following example shows how you display an element of type Text at the end of the ALV output: ... *... END_OF_LIST
create object lr_text exporting text = 'MyText'. gr_table->set_end_of_list( lr_text ). ... The following example shows how you insert a design object with a table-type layout at the beginning of the ALV output: ... *... TOP_OF_LIST data: lr_text type ref to cl_salv_form_text. data: lr_label type ref to cl_salv_form_label. data: lr_grid type ref to cl_salv_layout_grid,
create object lr_grid. lr_label = lr_grid->create_label( text = '1.1 LABEL' row = 1 column = 1 ). lr_text = lr_grid->create_text( text = '1.2 TEXT' row = 1 column = 2 ). lr_label->set_label_for( lr_text ).
lr_text = lr_grid->create_text( text = '2.2 TEXT' row = 2 column = 2 ). gr_table->set_top_of_list( lr_grid ). ...
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.
If you only insert a design object for display on the screen, it appears both on the screen and on the printout. If you insert a design object for display on the screen and another one for the printout, one appears on the screen and the other appears on the printout. If you only insert a design object for the printout, the design object only appears on the printout.
If Top of List Does Not Fit on One Page
As with all other design objects, the Top of List design object is limited to one page in length, which is predefined by the print format. You can however specify for the ALV output that Top of List can be longer than one page. This setting has the following effects:
On the screen output, the column titles of the ALV output are no longer frozen. When the user scrolls vertically, the column titles also roll with the list. You can choose the order in which the design objects for Top of List and Top of Page are arranged. Methods Function Allow Top of List with more than maximum permitted number of lines Class CL_SALV_TABLE Method SET_MODUS
CL_SALV_HIERSEQ_TABLE with the following constants: Sequencing: CL_SALV_FORM_CONTENT=> Top of List, Top of Page Sequencing: Top of Page, Top of List C_MODUS_EXCEED_TOL_TOP CL_SALV_FORM_CONTENT=> C_MODUS_EXCEED_TOP_TOL_EOP
You must call method SET_MODUS in your application after you call method FACTORY. Before you delete the instance of CL_SALV_TABLE or CL_SALV_HIERSEQ_TABLE or leave the program, reset method SET_MODUS back to C_MODUS_STANDARD.
What Goes Where?
You are not able to insert all variants of the design object in every ALV tool and in every display type. The following tables show which functions are possible in which environments:
Methods
To display the design object on the screen or on the printout, use the following methods: Function Before output, on screen Class CL_SALV_TABLE Method SET_TOP_OF_LIST
y In ALV outputs with multiple pages at the beginning or end of each page (page header or footer)
This chapter deals with the latter design object.
In contrast to the design object above or below the entire ALV output (TOP_OF_LIST and END_OF_LIST), the page headers and footers are events: If ALV determines that there is a page break when generating the printout, the END_OF_PAGE or TOP_OF_PAGE event is triggered. ALV checks whether a design object is defined for this event and inserts at the correct position.
Features
y Both in the TOP_OF_PAGE and in the END_OF_PAGE events, you are able to determine the actual number of pages using the PAGE parameter. y In the TOP_OF_PAGE event, you are also able to use the TABLE_INDEX parameter to get the table index of the entry. The table index is displayed on the current page. y In order to be able to display the desired design object in the END_OF_PAGE event, you have to expressly reserve the required number of lines. To do this, use the method SET_RESERVE_LINES in the CL_SALV_PRINT class. With the SET_RESERVE_LINES method you determine how many lines are served.
You are able to generate a maximum of five of such foreign key relationships.
In the hierarchical-sequential list, you are able to use the following special functions.
y y
Determining Data Tables for the Header- and Position Level Linking Data Tables for the Header and Position Level
You use most of the functions of the hierarchical-sequential list analog to the simple, two-dimensional table (such as aggregation, sorting, filter). Here you also have to specify for which of the hierarchy levels you want to execute the function. Features Linking Data Tables for the Header and Position Level You are able to link the two internal data tables of the hierarchical-sequential list with up to five foreignkey relationships.
Methods Function Link data tables Class Method CL_SALV_HIERSEQ_ FACTORY TABLE (Parameter T_BINDING_LEVEL1_LEVEL2) SET_DATA (Parameter T_BINDING) CL_SALV_HIERSEQ_ GET_BINDING LEVEL
Displaying or Hiding Position Rows By default, users cannot hide the position rows of a hierarchical-sequential list: there are no symbols to enable this function. You are able to define a column from the header level as an expansion column. This has the following effects:
y You are able to hide or display the position rows of a specific header row using the contents of this expansion column. y A symbol is displayed in each header row that the user can click to manually hide or display the associated position rows. y You are able to hide or display the position rows for all header rows simultaneously with your application. Methods
Function Define a column on the header level as expansion column Get current expansion column Hide position rows for all header rows Get current status of position rows
Class Method CL_SALV_COLUMNS_ SET_EXPAND_COLUMN HIERSEQ GET_EXPAND_COLUMN CL_SALV_HIERSEQ_ LEVEL SET_ITEMS_EXPANDED IS_ITEMS_EXPANDED
The Structure
The structureis defined by the initial table that you specify with the FACTORY method. It is displayed by the column header, which is the top row of the tree structure. Every node in a tree structure has exactly the structure that is defined in the initial table. y Hierarchy Column
The first column of the tree structure is always the hierarchy column. It is not part of the initial table. It contains symbols that the user can use to display or hide lower levels of a node. Using different icons, you are able to display whether a node is a branch with subnodes or a leaf. By default the hierarchy column has no text. However, for each node, you are able to determine which text is to appear in the hierarchy column. y Nodes
The actual entries in the tree structure are called nodes. Every node has the same structure as the initial table. Every node is uniquely identified by a key. A node can either be a leaf or a branch: Branches contain either more branches or leaves that are not subdivided any further as subnodes. y Item
Items are components of a node: Each node contains exactly as many items as are contained in the initial table. In this way you are able to compare items with the entries in a column.
Based on the deviating data model, you are able to make some settings to the tree structures that are not available in the other ALV tools. You are able to make the following settings for hierarchy column:
y Determining Column Header (Section: Determining Wording of the Column Header) y Inserting Icons into the Column Header (Section: Display Icon) y Determining the Tooltip for the Column Header (Section: Determining the Tooltip for the Column Header) y Define text for the node y Determine icons for expanded and collapsed branches y Display leaf as branch
You are able to make the following settings for nodes:
y y y
Get node objects Generate, move and delete nodes Collapse and expand branches
y y y
Full screen No
In the Container No
No Yes Yes
Each node is represented by an object of class CL_SALV_NODE, and all of the nodes together are represented by the object CL_SALV_NODES. You get the references to the desired node object using various getter methods:
Function All nodes together List of all node objects and their key Specific key Top node List of all subnodes and their key Get key for the node Related nodes
Class Method CL_SALV_TREE GET_NODES CL_SALV_NODES GET_ALL_NODES GET_NODE GET_TOP_NODE GET_SUBTREE GET_CHILDREN GET_KEY GET_PARENT GET_FIRST_CHILD GET_LAST_CHILD GET_PREVIOUS_SIBLING GET_NEXT_SIBLING
CL_SALV_NODE
Generate, Move and Delete Nodes While you can display whole tables with one command using the ALV tools: simple, two-dimensional table and a hierarchical-sequential list, with the tree structure, you need to generate the nodes individually. To do this, provide at least the following:
y The contents of the node that you wish to insert. The new node must have exactly the same structure as is specified in the initial table. y One reference node Every node is uniquely identified by a key. If there is not yet a node in the tree structure, there will still be the top node. By default, the top node has an empty character string as the key. You insert the new node at a position relative to the reference node.
y The relationship between the new node and the reference node You are able to insert the new node at one of the following positions relative to the reference node:
Methods Function Add nodes Change top node Move node to another position within the tree structure Delete node with all of its subnodes Delete all nodes of the tree structure
Determine Text in the Hierarchy Column The hierarchy column is not part of the initial table. This means you are not able to control text in it with the contents of the data table. You determine the texts in the hierarchy column for each node individually.
Class Method CL_SALV_NODES ADD_NODE SET_TOP_NODE CL_SALV_NODE MOVE DELETE CL_SALV_NODES DELETE_ALL
Methods Function Determine text in the hierarchy column Get current text in the hierarchy column Class Method CL_SALV_NODE SET_TEXT GET_TEXT
Determine Icons for Expanded and Collapsed Branches By default, a node that contains subnodes is indicated by an icon that looks like a folder. The icon looks different depending on whether the node is expanded or collapsed. You are able to use a different graphic for each icon. You determine both icons for each icon individually.
Methods Function Set icon for expanded branch Set icon for collapsed branch Get icon for expanded branch Get icon for collapsed branch
Display Leaf as Branch For reasons of speed, you are able to display a node as a branch even if it does not contain subnodes. When the user expands the node, you insert the subnodes.
A node that is displayed as a branch although it contains no subnodes is also called an empty folder. Methods Function Instead of displaying the icon for leaves, show the icon for a collapsed branch Check whether the node is an empty folder Display an expander in the empty folder Check whether the empty folder has an expander Class Method CL_SALV_NODE SET_FOLDER
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.
Collapse individual branch Expand all branches Collapse all branches Change visibility of a node Check whether the node is visible Change visibility of an item Check whether the item is visible
COLLAPSE CL_SALV_NODES EXPAND_ALL COLLAPSE_ALL CL_SALV_NODE SET_VISIBLE IS_VISIBLE CL_SALV_ITEM SET_VISIBLE IS_VISIBLE
Change the Content of a Node or an Item While you are modifying the contents of the two ALV tools simple, two-dimensional table and hierarchical-sequential list by making changes to the transferred table, changes also take place in the tree structure on the node or item level.
If you exchange the content of the whole node, the structure of the new one must exactly match the one specified by the initial table. Methods Function Change content of a node Get content of a node Change contents of an item Get content of an item
Set Display of the Item In items of the tree structure you are able to display things other than text. With the type of the item, you are able to determine that one of the following elements be displayed in it:
y y y y y y
For the types Checkbox (CHECKBOX), Pushbutton (BUTTON) and Link (LINK), there are events available to process interactions by the user.
The user can only change the value of checkboxes that are enabled. Methods
Function Set type of an item Get current type of the item Change value of a checkbox Check value of a checkbox Enable checkbox so that the user can change the value interactively Check whether a checkbox is enabled Insert icon Get icon
Class Method CL_SALV_ITEM SET_TYPE GET_TYPE SET_CHECKED IS_CHECKED SET_EDITABLE IS_EDITABLE SET_ICON GET_ICON
Set Selectability of an Item By default, the user is able to select an item by clicking on it or by pressing the tab key. You are able to determine that users cannot select an item.
Methods Function Set selectability of an item Check selectability Class Method CL_SALV_ITEM SET_ENABLED IS_ENABLED
Sorting by Columns
The sort settings for a column are represented by an object of type CL_SALV_SORT. The total of all the sort objects is represented by an object of type CL_SALV_SORTS. You are able to make calculations using the values of numeric columns. By default all values of a column are used for this. If you need intermediate results in addition to the overall result of the calculation, the rows that contain the subvalues of an intermediate result need to be next to each other: They sort the ALV output. The sort is then a prerequisite for ALV being able to determine and display intermediate results.
Features You are able to make the following settings for sorting:
y y y y y y
Get sort objects Create and delete sort objects Set sort direction Set column sequence of sorting Forbid changes Highlight control level change
Get Sort Objects In every main ALV class where sorting is possible, the GET_SORTS method exists. This method returns the sort objects for all columns in the ALV output (class CL_SALV_SORTS). Using this object with the methods GET or GET_SORT you get the sort object for the desired column.
Methods
Function Get SORTS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_SORTS CL_SALV_HIERSEQ_LEVEL Method GET_SORTS
GET GET_SORTS
objects for a hierarchy level Get a specific sort object Check whether a column is sorted (a sort object exists) Create and Delete Sort Objects You are able to create a maximum of one sort object for a column You are able to sort the ALV output using up to nine columns. You are able to delete sort objects either individually or all at once. CL_SALV_SORTS GET_SORT IS_SORT_DEFINED
Methods
Function Create sort object Delete individual sort object Delete all sort objects Class CL_SALV_SORTS Method ADD_SORT REMOVE_SORT CLEAR
If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Set Sort Direction For each individual sort object, you are able to determine whether you want to sort the column ascending (for example a, b, c) or descending (for example c, b, a): You set the sort direction.
Methods
Function Set sort Direction Get sort direction Class CL_SALV_SORTS CL_SALV_SORT CL_SALV_SORT Method ADD_SORT (Parameter SEQUENCE) SET_SEQUENCE GET_SEQUENCE
Set Column Sequence of Sorting If you sort the ALV output by multiple columns, the result changes depending on the sequence of columns that is used to sort.
By default, the columns are sorted in the sequence in which you generated your sort objects. You are able to change this sequence.
Methods
Function Change column sequence of sorting Forbid Changes By default, the user can change sort settings that you have specified using the application. However, you are able to expressly forbid this. Class CL_SALV_SORTS Method ADD_SORT (Parameter POSITION) SET_POSITION
Methods
Function Forbid changes to sort object Class CL_SALV_SORTS CL_SALV_SORT CL_SALV_SORT Method ADD_SORT (Parameter OBLIGATORY) SET_OBLIGATORY IS_OBLIGATORY
Check whether user is able to make changes to the sort object Highlight Control Level Change
If a value changes in a sorted column between two data records, this is called a control level change. You are able to highlight the control level change in two ways:
y y
You separate the group levels with a horizontal line. You start a new page for each control level.
Prerequisite
Methods
Function Activate grouping of the ALV output Check whether grouping of the ALV output has been activated. Set display of control level change Class CL_SALV_SORTS Method SET_GROUP_ACTIVE IS_GROUP_ACTIVE ADD_SORT (Parameter
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:
y The comparison value with which the rows are tested. This can be an individual value or an range for the given value. y The condition, that is, an operator that defines the necessary relation between the cell value and the comparison value (for example, greater than, less than or equal to) y Exclusion or inclusion, that is, whether the rows that fit the condition are to be displayed or whether they are not to be displayed All entries that have the value AA in the CARRID column should be displayed.
... gr_filter->add_filter( columnname = 'CARRID' sign = 'I' option = 'EQ' low = 'AA' ). ... With the columname parameter, you determine the column name With the low (or high) parameter, you determine the comparison value With the option parameter, you determine the condition With the sign parameter, you determine whether it is an inclusive or exclusive condition
Features You are able to make the following settings for aggregations:
y y y
Get filter objects and filter conditions Generate and Delete a filter object and filter condition Forbid filters for a column
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
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
Class CL_SALV_TABLE
Method GET_FILTERS
Get all filter objects Get all filter objects for a hierarchy level Get specific filter object Check whether a column is filtered (a filter object exists) Get all filter conditions for a filter object
CL_SALV_FILTER
GET
Generate and Delete a Filter Object and Filter Condition You are able to create a maximum of one filter object for a column. However, you are able to create any number of filter conditions for each filter object. You are able to delete filter objects either individually or all at once. The filter conditions for a filter object can only be deleted all at once.
You are only able to generate a filter object for columns in which you have not expressly forbid this (see the Forbidding Filters for a Column).
Defining a Filter Condition
When you define the first filter object for a column a filter condition is automatically generated. You make the settings for this using the parameters for the method ADD_FILTER. You create all further filter conditions for the same column using the ADD_SELOPT method. You manage all information for the filter conditions using the methods of class CL_SALV_SELOPT.
Methods Function Generate filter object Delete individual filter object Delete all filter objects Generate filter condition Delete all filter conditions Determine comparison value or area Class Method CL_SALV_FILTERS ADD_FILTER REMOVE_FILTER CLEAR ADD_SELOPT CLEAR SET_LOW SET_HIGH
CL_SALV_FILTER CL_SALV_SELOPT
Define condition (operator) Get condition (operator) Determine inclusion or exclusion Get inclusion or exclusion
If you assign a new data table with a new structure to your ALV output, all filter objects will be deleted automatically.
Forbid Filters for a Column By default you or the user is able to define a filter for every column. For each column you can determine whether a filter object can be defined for it.
Methods Function Forbid filters for a column Check whether filters are forbidden for a column Class Method CL_SALV_FILTERS SET_FILTER_ALLOWED IS_FILTER_ALLOWED
Usually all values in a column are used in a calculation during aggregation. You are also able to obtain intermediate results. To do this you have to sort the ALV output and group the rows that you want to use for the intermediate result. Prerequisites The column that you are aggregating has a numeric data type.
Features You are able to make the following settings for aggregations:
y y y
General Settings for the Aggregation Object Settings for the Results Rows Settings for Intermediate Results
y Total Adds all values for the column y Minimum Determines the smallest value for the column y Maximum Determines the largest value for the column y Average Determines the geometric average of all values in the column
You are able to create a maximum of one calculation for every column. The result of the calculation is then displayed in a separate Results Row. The settings for calculations (aggregation settings) for a column are represented by an object of type CL_SALV_AGGREGATION. The total of all the aggregation objects is represented by an object of type CL_SALV_AGGREGATIONS.
In addition to the calculation types listed above, you are also able to determine the total data records (see also Columns with Special Technical Meaning, the section on Counter Column to Determine Number of Rows). The result is displayed in the results row. The row count, however, is not represented by an aggregation object.
Features You are able to make the following settings for aggregations:
y y y y y y
Getting Aggregation Object Creating and Deleting Aggregation Object Determine the Type of Aggregation Determining the Position of the Results Row Allow and Forbid Aggregation The following is valid for all of these functions: Display type Classic ABAP list Yes Yes Full screen Yes Yes In the Container Yes Yes
The GET_AGGREGATIONS method, which returns all aggregation objects of the ALV output (class CL_SALV_AGGREGATIONS), exists in every main ALV class. Using this object with the methods GET or GET_AGGREGATION, you get the aggregation object for the desired column.
Methods Function Get AGGREGATIONS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_HIERSEQ_LEVEL GET_AGGREGATIONS CL_SALV_AGGREGATIONS GET GET_AGGREGATION IS_AGGREGATION_ DEFINED Method GET_AGGREGATIONS
Get AGGREGATIONS object for a hierarchy level Get all aggregation objects Get a specific aggregation object Check whether a column will be calculated (has an aggregation object)
Creating and Deleting Aggregation Object You are able to create a maximum of one aggregation object for a column You are able to delete aggregation objects either individually or all at once. You can also delete the settings for an aggregation object without deleting the aggregation object itself.
By default, columns with the numeric text (NUMC or n) data type cannot be aggregated. In these types of columns, you can only create an aggregation object if you expressly permit this. You can also only forbid aggregation for columns that can be aggregated. Methods Function Class Create an CL_SALV_AGGREGATIONS aggregation object Delete individual aggregation object Delete all aggregation objects Delete aggregation CL_SALV_AGGREGATION settings for an aggregation object Method ADD_AGGREGATION REMOVE_AGGREGATION CLEAR CLEAR
If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Specifying the Type of Aggregation For an aggregation object, you specify - in addition to the column name - which type of calculation you wish to make with it: you set the type of aggregation object.
Methods Function Set aggregation type Class Method CL_SALV_AGGREGATIONS ADD_AGGREGATION (Parameter AGGREGATION) CL_SALV_AGGREGATION SET CL_SALV_AGGREGATION GET
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.
y y
In columns that actually have a suitable data type, forbid aggregation In columns of data type numeric text, you expressly allow aggregation
Methods Function Forbid aggregation in suitable columns Check whether aggregation is allowed in suitable columns Allow aggregation in numeric text Check whether aggregation is allowed in numeric text Class Method CL_SALV_AGGREGATIONS SET_AGGREGATION_ ALLOWED IS_AGGREGATION_ ALLOWED SET_NUMERICAL_ AGGREGATION IS_NUMERICAL_ AGGREGATION_ON
Results Rows
You are able to perform various calculations for numeric columns in the ALV output and then display them in a results row. You are also able to sort the data records according to specific criteria and generate the intermediate results for each calculation. These intermediate results are also displayed in the results row. Beyond the options described here, you are not able to affect the content and appearance of the results row.
Use You are able to make the following settings for results rows:
y Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions) y Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)
Determining the Position of the Results Row You are able to define whether you wish to display the results row for the calculations in an ALV output above or below the rows that are included in the calculation.
Methods Function Class Determining the position CL_SALV_AGGREGATIONS of the results row Check where the results rows are located Method SET_AGGREGATION_ BEFORE_ITEMS IS_AGGREGATION_ BEFORE_ITEMS
You are also able to generate aggregations in and display intermediate results in the tree structure. However, here the intermediate results are automatically generated from the values of the subnodes in every node that has subnodes. The following information is thus only valid for the simple, two-dimensional table and the hierarchical-sequential list.
To generate intermediate results you have to provide certain information:
y To specify in which column the values from which the intermediate results are calculated are located, generate an aggregation object for the desired column. The overall result is displayed in the results row. y To specify which data records are contained in an intermediate result, group the data records: You sort the ALV output by the column that includes the criterion for the intermediate result. y To then display the intermediate results, you calculate the intermediate results using the column with the criterion. The most common way of generating intermediate results is to use subtotals. That is way you often find this term in place of intermediate results for all aggregation types. Nevertheless you can of course generate intermediate results (or subtotals) for all other aggregation types.
Prerequisites
You have generated an aggregation object for at least one aggregatable column.
y The column with the criterion for intermediate results is a column that cannot be aggregated. y You are able to generate intermediate results for up to nine columns.
Features You are able to make the following settings for intermediate results:
y y y
Generating Intermediate Results Hide Subvalues of Intermediate Results Determining the Position of the Results Row
y Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions) y Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)
For all of the following functions, this is valid:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Generating Intermediate Results
To display intermediate results in a column that already has an aggregation object, use the sort object from another column.
The column that contains the sort object has to have one of the following data types:
y alphanumeric data type or
Numeric text (NUMC or n), assuming you have not expressly permitted aggregation for this data type (see chapter Making Settings for Aggregation , Section Allow and Forbid Aggregation)
Methods
Function Class Method
Hide Subvalues of Intermediate Results You are able to hide the data records that form the subvalues of an intermediate result. To do this, specify the column that contains the criteria for the intermediate results, not the column that contains the calculated values.
Methods
Function Class Method
Hide subvalues of CL_SALV_SORTS SET_COMPRESSED_SUBTOTAL intermediate results Get column that only GET_COMPRESSED_SUBTOTAL displays results rows Check whether the CL_SALV_SORT IS_SUBTOTAL_COMPRESSED rows for an intermediate result are hidden or displayed
You are not able to use the ALV object model to either create or delete layouts.
Layouts can be available to only one user or for all users of your application. Depending on that, the layout is designated as either a user-specific layout or a layout for all users. You are able to determine whether users are allowed to save user-specific layouts or whether they are authorized to save layouts for all users as well.
User-specific layouts and layouts for all users also differ in their names:
y y y The names of user-specific layouts start with a letter (A-Z). The names of layouts for all users start with '/'. The names of standard layouts provided by SAP start with a number (0-9).
Layout Key
All layouts for all applications are saved centrally. To enable a layout to be assigned to your application, set a layout key. All layouts that users save to your application can then be identified with this layout key and a name. Features You are able to make the following settings for layouts:
y y y y y
Get layouts Set layout key Determine for whom users can save layouts Change layout for start of the ALV output Display dialog box for layout
The following is valid for all of these functions: Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential Classic ABAP list Yes Yes Full screen In the Container Yes
Yes
Yes
Yes
You are able to get the settings for layouts that users have saved for your application.
Methods
Function Get layout object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE Get settings for individual layouts Get current layout Set Layout Key The layout key is a prerequisite for users are able to save a layout to your application. The layout key includes the following information: CL_SALV_LAYOUT GET_LAYOUTS GET_CURRENT_LAYOUT Method GET_LAYOUT
y y
Name of the application A key that uniquely identifies the output table within your application
y A logical group for further specification (for example with multiple ALV instances in one program) Methods
Function Set layout key Get layout key Class CL_SALV_LAYOUT Method SET_KEY GET_KEY
Determine for Whom Users Can Save Layouts By default, users are not able to save layouts. You are able to determine whether users can save layouts
y y
Only for themselves (user-specific) Only for other users (for all users)
Methods Function Determine for whom users can save layouts Check for whom users can save layouts Change Layout for Start of the ALV Output You have to ways of changing which layout will be used when the ALV output is started: Class CL_SALV_LAYOUT Method SET_SAVE_RESTRICTION GET_SAVE_RESTRICTION
y You allow the user to set one of the layouts as default. Depending on whether users choose a user-specific layout or one that is available to all users, the default is only valid for the user himself or for all users of the application. y You define a layout as initial layout. In this way, you override any defaults set up by the user. Methods
Function Allow defaults Get layout that was set by a user as a default Checks whether the user has set a layout as default Set initial layout Get initial layout Display Dialog Box for Layout You are able to display a dialog box that provides the user with a selection of layouts that are saved for your application. Class CL_SALV_LAYOUT Method SET_DEFAULT GET_DEFAULT_LAYOUT HAS_DEFAULT SET_INITIAL_LAYOUT GET_INITIAL_LAYOUT
Methods
Function Display dialog box Class CL_SALV_LAYOUT Method F4_LAYOUTS
The current cell indicates the position of the cursor in the simple, two-dimensional table and the hierarchical-sequential list. The current cell is highlighted differently from the selected cells. In this way you are able to recognize the current cell when you are in a selected area. Features You can make the following settings for the selection in the ALV output:
y y y y
Get settings for selection and information on the selected areas Set selection type Enable selection of nodes and items Select area
Get Information on Selections The method GET_SELECTIONS that returns the selection object exists in each main ALV class. With this object, you get the desired information with various getter methods.
Methods
Function Get selection object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_HIERSEQ_LEVEL Method GET_SELECTIONS
GET_SELECTIONS
Set Selection Type With the selection type, you set which cells users are able to select simultaneously, that is, whether and how they can combine the selections. The selection type has different effects in the various display types. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure The following selection types are available: Classic ABAP list Yes Yes No No Full screen In the Container Yes
Yes
y y y y y
The following table shows which selection type you have to assign to the ALV output to enable users to execute the desired function.
SINGLE
Methods
Function Set Selection Type Get selection type Enable Selection of Nodes and Items In the tree structure, you can determine whether the user is allowed to select individual nodes or items. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP list No No Yes Yes Full screen In the Container No Class CL_SALV_SELECTIONS Method SET_SELECTION_MODE GET_SELECTION_MODE
No
Methods
Function Set selectability of the item Check whether the item can be selected Markierbarkeit des Knotens festlegen Check whether the node can be selected Select Area You are able to set selections in the ALV output using your application. Class CL_SALV_ITEM Method SET_ENABLED IS_ENABLED CL_SALV_NODE SET_ENABLED IS_ENABLED
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Full screen
Yes
Yes
Yes
Methods
Function Set current cell Get current cell Select cells Get selected cells Select rows Get selected rows Select columns Get selected columns Select node Get selected nodes Select item Get selected item Class CL_SALV_SELECTIONS Method SET_CURRENT_CELL GET_CURRENT_CELL SET_SELECTED_CELLS GET_SELECTED_CELLS SET_SELECTED_ROWS GET_SELECTED_ROWS SET_SELECTED_COLUMNS GET_SELECTED_COLUMNS SET_SELECTED_NODES GET_SELECTED_NODES SET_SELECTED_ITEM GET_SELECTED_ITEM
You are only able to change the font in full-screen display or in display in a container, not in the classic ABAP list.
You can make the following settings for the appearance of the ALV output:
y y
Defining Colors for Columns, Rows and Cells Setting Text Properties
y y y y y
Hiding Lines Between Columns and Rows Changing the Display of Numeric Values Determining Column Width Arranging a Data Record in Multiple Rows Designing Header and Footer Areas of the ALV Output
The various ALV tools use different concepts when dealing with color:
In the tree structure, some fixed combinations of text and background color are available. Colors in the Tree Structure Text Color Black Black Black Black Black Black Black Gray Dark Blue Dark Red Background Color Standard Light yellow Medium blue Light blue Salmon colored Red Green Standard Standard Standard Technical Name DEFAULT EMPHASIZED EMPHASIZED_A EMPHASIZED_B EMPHASIZED_C EMPHASIZED_NEGATIVE EMPHASIZED_POSITIVE INACTIVE INTENSIFIED INTENSIFIED_CRITICAL
In both of the other tools you are able to change the combinations of text and background color to a certain degree:
y You choose a color from a set of possible colors.
y y
You determine whether this color is to be light or dark (intensity) You determine whether the color applies to the background or the text (inverse display)
Colors in List-Type ALV Outputs Color GUIDependent Gray Blue Light Gray Yellow Blue Green Green Red orange Technical Name COL_BACKGROUND COL_HEADING COL_NORMAL COL_TOTAL COL_KEY COL_POSITIVE COL_NEGATIVE COL_GROUP
The color COL_KEY is the color that the system uses for Lead Columns.
Features You are able to make the following settings for colors:
Lead Columns have a color determined by the system. In lead columns you are only able to change the color in individual cells. In list-type ALV outputs, you are able to color in rows or cells using the Color Column. You color in whole columns by changing the color property of the column. In the tree structure, however, you can color in nodes and items directly using the associated methods. You are not able to color in columns here. You can present the entire ALV output with stripes, that is automatically color in the rows of the ALV output alternating light and dark.
Changing the Color of Columns The color is a property of the column. You can change them directly this way.
You are only able to change the color of a column if it is not a lead column. Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Classic ABAP List Yes Yes Full Screen Yes In the Container Yes
Tree structure Methods Function Changing the Color of Columns Get the color of a column
No
No
Change Color of Nodes and Items In the tree structure, the color is the property of each node or individual item.
Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Change color combination for node Get color combination for node Change color combination for item Get color combination for item
Display Rows with Stripes
You are able to color the rows of the ALV output alternating light and dark.
The colors for both shades are defined by the system and you cannot change them. Display Type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP List Yes Yes Full Screen Yes No In the Container Yes No
Methods Function Set striped pattern Check whether the striped pattern is set Class Method CL_SALV_DISPLAY_SETTINGS SET_STRIPED_PATTERN IS_STRIPED_PATTERN
Accessible Color Display To make colored identifiers of ALV elements accessible to visually-impaired users it is necessary to maintain a tool tip for the color. This takes place using the method ADD_TOOLTIP of the class CL_SALV_TOOLTIPS. You can find more information in the class documentation in the system.
y y y y y
Set font Set alignment of the text in the column Determine lowercase and uppercase Determining display of empty cells Changing text color
Set Font You are able to change the font of text in the design object (header and footer area of page or list) and in the tree structure.
Font in Design Object
In the classic ABAP list, the various element types that you are able to use in a design object differ in the font. In the other two display types they differ in font, font size and font color. The following graphic provides a comparison of the fonts as they are set in the various display types for the ALV output for the four element types.
This is how you set the font in the design object using a choice of element type.
Font in the Tree Structure
y y y
Standard font A non-proportional font (all characters require the same amount of space) A proportional font (characters have different widths) Display type Classic ABAP list No No Full screen No Yes In the Container No Yes
ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function
Class
Method
Set Alignment of the Text in the Column You are able to set where the content of a column will be put:
y y y
You are able to change the alignment of text in the design object (header and footer area of page or list) and in the ALV output.
Alignment in the ALV Output
You are able to set the alignment of the text for each column in the ALV output separately.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function
Class
Method
For the following elements, you are able to set the alignment in the design object:
y y y y
y y
The text is in a table-type layout. The column in which the text is located is wide enough.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function Class
Method
Set alignment in the design object Get alignment in the design object
Determine Lowercase and Uppercase If the texts in the internal data table use both uppercase and lowercase letters, you are able to choose whether they will be maintained in the ALV output or whether the lowercase letters should be converted to uppercase letters.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function
Class
Method
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods
Function
Class
Method
Determine display of empty cells Check how empty cells are to be displayed
y y y
Hide lines between columns and rows Display lines in the design object of the header and footer areas of a list or page Display Lines Between Control Levels (Highlight Control Level Change section)
Displaying Lines in the ALV Output To display lines in the ALV output, you use one method for lines and one for columns.
Full screen
Yes
Tree structure
No
No
Methods Function
Display lines between rows Checks whether lines between the rows are being displayed Display lines between columns Checks whether lines between the columns are being displayed Displaying Lines in the Design Object You are only able to display lines in table-type layouts within the design object. Here you use one method to determine whether you want to display vertical, horizontal, both or no lines. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Yes Yes Yes Yes Yes Yes Classic ABAP list Full screen In the Container
Class
CL_SALV_DISPLAY_SETTINGS
Method
SET_HORIZONTAL_LINES IS_HORIZONTAL_LINES SET_VERTICAL_LINES IS_VERTICAL_LINES
Methods Function
Displaying Lines in the Design Object
Class
CL_SALV_FORM_LAYOUT_GRID
Method
SET_GRID_LINES
y y y y
With each of these properties, you either move the decimal point the desired number of places (thus changing the value of the number) or you change the number of decimal places after the decimal point (the value of the number then stays the same). You are also able to combine two or more options. You are able to apply each of the properties in two ways:
y You assign the desired property with a specific value to the column that contains the values to be displayed. Each of the values in the column is changed and displayed in the same way. y You use a separate column that applies the desired property to individual rows of the ALV output. For more information, see Columns with Special Technical Significance, in the section called Control Columns That Are Assigned to a Column.
Features You are able to make the following settings for numeric columns:
y Setting properties such as number of decimal places, units of measure, currency and rounding y y y Displaying or hiding sign Hide or display leading zeros Determining Display of Empty Cells
Display type Classic ABAP list ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Yes Yes
Full screen
Yes Yes
Determining Decimal Places, Units of Measure, Currency and Rounding You determine the number of decimal places, along with the unit of measure, currency and rounding for each column individually.
Methods
Function Determine number of decimal places Get number of decimal places Determine unit of measure Get unit of measure Determine currency Get currency Determine rounding Get rounding Class CL_SALV_COLUMN Method SET_DECIMALS GET_DECIMALS SET_CURRENCY GET_CURRENCY SET_QUANTITY GET_QUANTITY SET_ROUND GET_ROUND
For columns with DDIC reference, the GET_DDIC_DECIMALS of class CL_SALV_COLUMN returns the number of decimal places that is set for the referenced data element.
Displaying or Hiding sign By default, positive numbers are displayed without sign, and negative numbers are displayed with sign. You are able to determine that the sign (-) not be displayed for negative numbers.
Methods
Function Displaying or hiding sign Checks whether sign is being displayed or hidden Class CL_SALV_COLUMN Method SET_SIGN HAS_SIGN
Hiding or Displaying Leading Zeros For columns with data types n or NUMC (numeric text), the places that are in front of the value are filled with zeros (0). You are able to hide or display these zeros in front of a value. Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Classic ABAP list Yes Yes Full screen In the Container Yes Yes
Yes Yes
Methods
Function Hiding or Displaying Leading Zeros Checks leading zeros are being displayed or hidden Class CL_SALV_COLUMN Method SET_LEADING_ZERO HAS_LEADING_ZERO
y y y y y
Set output width of a column (COLUMN object) Set width of hierarchy column in the tree structure Change width of a column in table-type layout of a design object Adapt width to space needed for the values Hide column completely (section called Settings Visibility of a Column)
Set Output Width You are able to set the width of a column in the content of the ALV output no matter how large the field has been defined for the internal data table.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set column width Get column width Get column width of the referenced data element
Set Width of Hierarchy Column
You are able to choose whether you want to specify the width of the hierarchy column in the tree structure in pixels or in characters.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set whether the width of the hierarchy column is specified in characters or in pixels Check whether the width of the hierarchy column is specified in characters or in pixels Set width of hierarchy column
SET_HIERARCHY_SIZE
GET_HIERARCHY_SIZE
Width of a Column in Table-Type Layout of a Design Object If you use a table-type layout in a design object, you control the width of the column using its contents: the longer the text in a cell, the wider the column. Adapt Width to Space Required by Values You are able to automatically set the width of columns so that all values are displayed completely by optimizing the column. You can make this setting for each column individually or for all columns simultaneously.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Optimize individual column Check whether a column is optimized Optimize all columns simultaneously Check whether all columns are optimized
Class CL_SALV_COLUMN
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.
If you spread a data record over multiple rows the ALV output is automatically displayed with stripes.
Features For each individual column you determine in which row of a data record you wish to display your values.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Arranging values in multiple rows Get rows in which the data is being displayed
Full screen No No
In the Container No No
When you display the ALV output in a separate dialog box, the screen status SALV_TABLE_STDPOPUP (function group SALV_METADATA_STATUS) is automatically used. If you want to change this screen status, make a backup copy of the original screen status beforehand and then make your desired changes.
Features You are able to make the following settings for the ALV popup:
y y
Display ALV output in a dialog box Specify the size of the dialog box
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Display ALV Output in a Dialog Box
In the Container No No
You display the ALV output in the dialog box by specifying the position of the dialog box on the screen. This is measured in columns and rows of characters: each character corresponds in width to one column, in height to one row. You specify the distance between the dialog box and the left side of the screen in columns and from the top of the work area in rows.
Methods
Class Method CL_SALV_TABLE SET_SCREEN_POPUP CL_SALV_HIERSEQ_TABLE (Parameter START_COLUMN bzw. START_LINE) GET_SCREEN_POPUP
Specify the Size of the Dialog Box You specify the size of the dialog box only indirectly:
y The width of the dialog box is determined from the distance between the right side of the dialog box and the edge of the screen y The height of the dialog box is determined from the distance between the bottom of the dialog box and the upper edge of the work area.
Methods
Function Specify the Size of the Dialog Box Specify the size of the
Class Method CL_SALV_TABLE SET_SCREEN_POPUP CL_SALV_HIERSEQ_TABLE (Parameter END_COLUMN bzw. END_LINE) GET_SCREEN_POPUP
dialog box
y You provide Pushbuttons or Menu Entries for generic ALV functions or define your own application-specific functions y In the columns of the ALV output, you provide elements for interaction such as pushbuttons, checkboxes or hyperlinks y y You process the users clicks and double clicks on the ALV output. You process specific key actions from the user
In every event handler method, you are able to change the content of the data table, for example. Then you need to refresh the display with the REFRESH method.
y Generic ALV Functions You are able to enables these functions independent of the objectives of your application. Generic ALV functions are sorting, filtering, managing layouts, printing, and so on. y Custom Application-Specific Functions You use your application to provide functions that are specially customized to the requirements of this application. In the ALV output, you make pushbuttons available with which users can trigger the function.
Screen Status
When you display a tree structure or a simple, two-dimensional table in a container, simply specify your desired functions with the appropriate setter method. In the following display types, on the other hand, ALV controls the entire screen:
y y y
Simple, two-dimensional table in full screen Hierarchical-sequential list Tree structure in the full screen
Here you can decide which screen status will be used and also which functions will be offered to the user as menu entries and which ones will be offered as pushbuttons. In these display types, you are only able to display those functions that you have also entered into the screen status. Features Setting Screen Status You make the following settings with screen status in the full-screen display of the ALV output:
y y y
Which generic ALV functions and which custom functions the user can use Which functions are offered as pushbuttons and which are offered as a menu entry In which order the pushbuttons or menu are displayed
y For the simple, two-dimensional table and the hierarchical-sequential list of the screen status SALV_TABLE_STANDARD in the function group SALV_METADATA_STATUS y For the tree structure of the screen status STANDARD_TREE in the function group SLVC_FULLSCREEN Do not change the original screen status. If you want to make changes to the screen status, for example because you want to make custom functions available, use the original screen status as a copy template and then change the copy as needed.
You are able to set another screen status.
In the Container No
Hierarchical-sequential list Tree structure Methods Function Set screen status Get screen status
Yes Yes No
The names of all generic ALV functions are listed as constants in the interfaces IF_SALV_C_FUNCTION LIST (for the simple, two-dimensional table and the hierarchical-sequential list) or IF_SALV_C_FUNCTION_TREE (for the tree structure).
When Users Execute the Function
When users select the pushbutton for a generic ALV function, they trigger two events (one after the other):
y BEFORE_SALV_FUNCTION The event takes place before the function is executed y AFTER_SALV_FUNCTION The event takes place after the function is finished
Both events originate in the classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE. If you register your application for these events, you are able to handle user actions and start a desired function.
Depending on whether you use a generic function in an ALV output in a container or in a full-screen display, you proceed differently to set the position of a pushbutton or menu entry:
y In container display (simple, simple two-dimensional table or tree structure) you are not able to change the sequence of the pushbuttons. y In the other display types, you use the screen status to set the position of a pushbutton or the menu entry. The pushbutton is then displayed at the position set here no matter in which sequence you call the SET functions. You are only able to set a function as a menu entry using the screen status. In the container display you are not able to influence the menu structure.
Function Groups
You are able to enable or disable every generic ALV function. Most generic ALV functions however, are part of groups of functions that have been grouped together logically. In this way, you are able to enable all of the functions for this group with one command. Features You are able to make the following settings for generic ALV functions:
y y y
Get function settings Enable generic ALV functions Check visibility and activation status of a self-defined function
Display type ALV Tool Simple, two-dimensional table Hierarchical-Sequential List Tree structure
Get function settings
With every function that you activate, you generate an object of class CL_SALV_FUNCTION. You manage all of these objects using the list of all function objects: CL_SALV_FUNCTIONS_TREE (for the tree
structure) or CL_SALV_FUNCTIONS_LIST (for the simple, two-dimensional table or the hierarchicalsequential list). The method GET_FUNCTIONS that returns the settings for all functions exists in each main ALV class. Using this object, you make all settings for the generic ALV functions.
Methods Function Get FUNCTIONS object Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE Method GET_FUNCTIONS
Get all function objects Check whether a function is a generic ALV function
GET_FUNCTIONS IS_SALV_FUNCTION
Enable Generic ALV Functions For every generic ALV function, there is a setter method that you use to make the pushbutton or menu entry for the function visible and usable for the user. You have various options for displaying generic ALV functions:
y You enable a function group. All of the functions for this function group are enabled simultaneously y You enable all generic ALV functions simultaneously
In the list-type ALV outputs (simple, two-dimensional table and hierarchical-sequential list), there is also a preset default selection of the most frequent generic ALV functions. Methods Function Enable individual generic ALV functions Enable function group Enable all generic ALV functions Class CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE SET_GROUP_ <Function group> SET_ALL Method SET_ <generic ALV function>
CL_SALV_FUNCTIONS_LIST
SET_DEFAULT
Check Visibility and Activation Status of a Self-Defined Function With the setter methods (see above), you render a generic ALV function visible or hidden. In some cases, a generic ALV function can be visible, but temporarily not operable: the generic ALV function is disabled. Although you are able to change the activation status of self-defined functions, you do not have this option for generic ALV functions. Here the internal logic of ALV determines whether or not a function is operable.
You set the group Filter, making the functions SET_FILTER and SET_FILTER_DELETE visible. As long as you have not defined a filter, the function SET_FILTER_DELETE remains disabled.
You are able to check the activation status of a self-defined function However, the associated method does not include the activation status that the system has set based on its internal logic.
When you try to change the activation status of a generic ALV function, you get an error. Methods Function Check visibility Check activation status Class CL_SALV_FUNCTIONS_LIST CL_SALV_FUNCTIONS_TREE Method IS_VISIBLE IS_ENABLED
If users select the pushbutton for a function that you have defined, they trigger the event ADDED_FUNCTION of classes CL_SALV_EVENTS_LIST or CL_SALV_EVENTS_TREE. If you register your application for this event, you get control in the method for the event handler and can start your desired function code.
Arrangement of the Pushbuttons
Depending on whether you use a self-defined function in an ALV output in a container or in a full-screen display, you proceed differently to set the position of a pushbutton or menu entry:
In the container display (simple, two-dimensional table or tree structure) you are able to choose whether you want to place the pushbuttons for self-defined functions to the right or the left of the pushbutton for the generic ALV functions: You also use the sequence in which you create the self-defined functions to set the sequence of the pushbuttons. In the container display, you are only able to add pushbuttons in the application toolbar. You are not able to generate menu entries. In the other display types, you use the screen status to set the position of a pushbutton or the menu entry. The pushbutton is then displayed at the position set here no matter in which sequence you create the functions.
Features You are able to make the following settings for self-defined functions:
Get function settings Create and display self-defined functions Check visibility and activation status of a self-defined function Instead of a self-defined function, execute a generic ALV function
Get Function Settings With every function that you activate, you generate an object of class CL_SALV_FUNCTION. You manage all of these objects using the list of all function objects: CL_SALV_FUNCTIONS_TREE (for the tree structure) or CL_SALV_FUNCTIONS_LIST (for the simple, two-dimensional table or the hierarchicalsequential list). The method GET_FUNCTIONS that returns the settings for all functions exists in each main ALV class. Using this object, you make all settings for the self-defined functions.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Method GET_FUNCTIONS
In the container display (simple, two-dimensional table or tree structure), you strictly create a function object with the desired properties and display the pushbutton. In the other display types, you generate the function object indirectly by entering the selfdefined function into the screen status. Here the function is display directly. You do not have to provide any other commands for the display.
In full-screen displays, you determine the appearance, tooltip and position for the function using the screen status, but in the container display, you make these settings when you are generating the function object.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Create and display a function object for a selfdefined function Delete function object Check whether a function object already exists Set text for a pushbutton Set icon for a pushbutton
Full screen No No
Method ADD_FUNCTION
Set position within the application toolbar Set tooltip for the pushbutton
Check Visibility and Activation Status of a Self-Defined Function You can show and hide pushbuttons or menu entries for self-defined functions. In addition you are also able to affect the operability of a self-defined function in contrast to generic ALV functions: you enable or disable the function. For the visibility of self-defined functions, the following is valid:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Show or hide a selfdefined function Check visibility Enable / disable a selfdefined function Check activation status
Full screen No No
Class CL_SALV_FUNCTIONS_LIST
Method SET_FUNCTION
Instead of a Self-Defined Function, Execute a Generic ALV Function Usually you want to execute the self-defined function for which you have defined a pushbutton or menu entry upon user action. However, in specific cases, if you wish to execute a function other that the one
originally set, you are able to specify the desired (alternative) generic ALV function in the event handler routine of the event ADDED_FUNCTION.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Instead of a self-defined function, execute a generic ALV function
Full screen No No
y Checkbox In list-type ALV ouputs, the checkbox is disabled. With the content of the column, you are only to display whether the checkbox is set or not. In the tree structure, however, you are able to handle users actions on this element using an event. y Pushbutton You are able to handle user actions on this element with an event. y Hyperlink You specify the Internet addresses (URLs). Users can then call up the corresponding page in the Internet browser by clicking on one of these Internet addresses. y Click Area You are able to handle user actions on this element with an event. In list-type ALV outputs, the setting for interactive elements is called cell type. In tree structures it is called type of item.
Features You are able to make the following settings for interactive elements:
y y
Get Current Setting In list-type ALV outputs, you are able to assign the cell type in two ways:
y All cells of a column get the same cell type. Here the cell type is thus a property of the column. y Using a column for cell types, you assign any cell type to each of the individual rows.
In the tree structures, on the other hand, the type is a property of the item. Depending on of what the cell / item type is a property, you proceed differently to obtain the current settings.
Methods Function Get the property of a column Check whether a column exists for cell types Get the cell type of a column Get properties of an item Class CL_SALV_TABLE Method GET_COLUMNS
CL_SALV_COLUMNS_LIST GET_CELL_TYPE_COLUMN
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
Checkbox Display
Use A checkbox displays two statuses: the indicator is set (a checkbox is displayed in the field) or it is not set (the field is empty). Both statuses can be overwritten by the activation: if a checkbox is enabled (the field is white), the user can change the status of the checkbox by clicking on it. If the checkbox is disabled (the field is gray) a click does not change anything. You are able to display your ALV output in cells or items.
In the class ABAP list and the hierarchical-sequential list, you are able to use display type to determine that a checkbox be displayed in front of every row for the user to select the row.
You are able to display checkboxes in all ALV tools. In the classic ABAP list and the hierarchicalsequential list, however, you are not able to activate the checkboxes, which means the user is not able to change the value of a checkbox.
If the User Changes the Value
You are able to enable checkboxes, which means you allow the user to change the value of the checkbox. Then you are able to handle the following events with your application:
In the simple, two-dimensional table, the user triggers the event LINK_CLICK from class CL_SALV_EVENTS_TABLE by changing the checkbox. In the tree structure, the user triggers the event CHECKBOX_CHANGE from class CL_SALV_EVENTS_TREE
Data Type, Cell Type and Value
The cells or items in which you wish to display the checkbox must have an alphanumeric data type. Depending on whether you are using checkboxes in list-type ALV outputs or in the tree structure, you proceed differently when setting the value of the checkbox:
In the other ALV tools, you control the display of the checkbox using the combination of cell type and value of the cell:
y y The CHECKBOX cell type always displays a disabled checkbox. The cell type CHECKBOX_HOTSPOT shows an enabled checkbox For the values 1 or X , the indicator for the checkbox is set. For the values 0 or indicator is not set.
, the
The following table shows which value a cell or an item needs to include so that the checkbox is displayed as you want it to be: Value of a Checkbox Checkbox Description Checkbox enabled Indicator not set Checkbox enabled Indicator set Checkbox disabled Indicator not set Checkbox disabled Indicator set Checkbox hidden Value of the Cell CHECKBOX_ 0 or HOTSPOT CHECKBOX_ 1 or X HOTSPOT CHECKBOX 0 or CHECKBOX CHECKBOX CHECKBOX_ HOTSPOT
Features You are able to make the following settings for checkboxes:
Cell Type
1 or X -
Display checkbox (assign cell and item type) Enable/disable checkbox in the item Set/remove indicator for the checkbox in the item
Checkbox Display
To display a disabled checkbox in a list-type ALV output, use the cell type CHECKBOX. To display an enabled checkbox in the simple, two-dimensional table (full screen or container), use the cell type CHECKBOX_HOTSPOT. To display a checkbox in a tree structure, use the type of item CHECKBOX
Enable/Disable Checkbox in the Item In order for the user to be able to change the value of a checkbox in the tree structure, you have to enable it.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Enable checkbox Check whether the checkbox is enabled
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.
Full screen
In the Container
Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Set the indicator for the checkbox Check whether the indicator for the checkbox is set
No No
No Yes
No Yes
Set/Remove Indicator for the Checkbox in the Cell In list-type ALV outputs, you can only control whether the indicator of a checkbox is set or not with the value of the cell. In enabled checkboxes (cell type CHECKBOX_HOTSPOT), you are able to use the event LINK_CLICK to adapt the value of the cell when the user clicks on the checkbox.
Pushbutton Display
Use Pushbuttons help users to trigger an event that you are able to process as needed. You are able to display pushbuttons in the ALV output. The value of the cell is then displayed as a label for the button. These are valid for the functions of pushbuttons:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
If users select a pushbutton, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_TREE)
y Features You are able to make the following settings for pushbuttons: ...
y To display a cell as pushbutton in container display of a simple, two-dimensional table, use the cell type BUTTON. y To display a pushbutton in a tree structure, use the type of item BUTTON.
Columns that contain the key for the hyperlink object have data type INT4.
You can also determine that the Internet address that is displayed in the cell has been enabled as a click area. This means, when the user clicks on the Internet address, an Internet browser starts, which takes the user to the specified Internet page. To enable an Internet Address as a Click Area use the cell type. These are valid for the functions of Internet addresses:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Features
You are able to make the following settings for Internet addresses:
y y y
Get hyperlink objects Create, change and delete hyperlink objects Display Internet Address
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.
Get all hyperlink objects Get a specific hyperlink object Get Internet address Get key
CL_SALV_HYPERLINK
GET_HYPERLINK GET_HANDLE
Create, Change and Delete Hyperlink Objects You are able to create any number of hyperlink objects. A hyperlink object includes two components: the Internet address and a key that you can use later to address the hyperlink object. You are able to delete hyperlink objects either individually or all at once.
Methods Function Create hyperlink object Delete individual hyperlink object Delete all hyperlink objects Change hyperlink object Class Method CL_SALV_HYPERLINKS ADD_HYPERLINK REMOVE_HYPERLINK
CLEAR
CL_SALV_HYPERLINK
SET_HYPERLINK
(address)
Define Internet Address as Click Area To define the Internet address in a cell as a click area, that is, to display it underlined, use the Cell Type LINK.
You are able to display icons in a column. If you later define the cells with the icons as click areas, the user then triggers the event by clicking on the icon.
These are valid for the functions of click areas:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
If users select a click area, they trigger the LINK_CLICK event (class CL_SALV_EVENTS_TABLE or CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE)
y Features You are able to make the following settings for click areas: ...
y y
To define a cell as a click area in a list-type ALV output, use the cell type HOTSPOT To define an item in a tree structure as a click area, use the type of item LINK.
y Double click on a cell or an item of the ALV output or alternatively Selecting a cell or an item of the ALV output and pressing F2 For more information on clicking options, see Displaying Interactive Elements
Features You are able to make the following settings for mouse actions:
y y
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
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:
y The cells/items for which these functions are to be triggered have a specific Cell or Item Type:
y y
In list-like ALV outputs, the cells have the cell type HOTSPOT In tree structures the items have the item type LINK
y You have registered your application for the event LINK_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE) and programmed it into a suitable event handler.
Functions for Double Click or F2 You have two options for processing the double click or F2 being pressed:
y You register your application for the event DOUBLE_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE) or y You specify the function code of the function directly that is to be executed with a double click or F2. The DOUBLE_CLICK event returns the position (cell or item) where the user double clicked. The second option, on the other hand, does not return information about exactly where the double click occurred. Methods Function Set function code Get function code Class Method CL_SALV_FUNCTIONAL_SETTINGS SET_F2_CODE GET_F2_CODE
y F1 Function Key The user calls a help text for the selected column using the F1 function key. y F2 Function Key This key is always an alternative to double clicking. You determine which function is triggered when the user double clicks or presses F2. You cannot change its meaning. y F4 function key With the F4 function key, users call a value list with possible entries that are possible and useful for their current situation.
Features You are able to make the following settings for key settings:
y y
Using an F1 Help Text for Another Data Element Assigning any functions to keys
Assigning Any Functions to Keys In the tree structure, you are able to specify functions for a selection of keys and key combinations that are to be executed when the user presses these buttons.
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
You proceed in two steps:
y You specify which of the possible keys trigger the event KEYPRESS of class CL_SALV_EVENTS_TREE. You repeat this specification for every key that you wish to register for the event. y You specify which function will be executed when the user presses the appropriate key. To do this, register the application for the event and program the desired event handler.
You can assign the following keys and key combinations in the tree structure with the desired functions:
y y y y y y y
F1 function key F4 function key Remove Enter key Insert Control plus X Control plus C
Control plus V
By default, each key listed here is used for very specific purposes (for example, with the F4 function key, the user calls a dialog box with a value list of the permitted or useful entries for the current column). Find out about the conventions in your company as to the meaning of the individual keys. SAP recommends that you do not change the original objectives of the keys. Methods Function Register the key for an event Delete entire list of keys that trigger the event Class Method CL_SALV_EVENTS_TREE ADD_KEY_FOR_KEYPRESS REMOVE_ALL_KEYS_ FOR_KEYPRESS
y F1 Help For each column, you specify a DDIC element that includes a suitable F1 help text. If the user selects a column and presses the F1 function key, the help text appears. y ToolTips You are able to define tooltips for various elements of the ALV output. If the user moves the mouse pointer over the element and rests it there for a moment, the text box with the tooltip text appears. In the tree structure you are able to handle events for various keys and to define any functions for them in this way. The function keys F1 and F4 are also available here. SAP recommends that you only use these keys for the help functions.
Provide Tooltips
Use Tooltips allow you to define short help texts for various elements of the ALV output:
y By default the texts for tooltips are displayed for users when they move the mouse pointer over the column header and rest it there for a moment.
y For physically impaired users, especially blind or visually impaired ones, the tooltip texts are read aloud using screen reader technology.
You are able to define tooltips for the following elements of your ALV output:
y y y y
For column headers For functions in the application toolbar For colors, exceptions and symbols For elements in the design object
Depending on the element for which you want to define a tooltip, you proceed differently. Features You are able to make the following settings for tooltips:
y y y y y
Tooltip Object Management and Generation for Colors, Exceptions and Symbols Generation of Tooltips for Column Headers Generation of Tooltips for Functions Generation of Tooltips for Icons and Symbols Generation of Tooltips for Elements in the Design Object
y y y
You use tooltip objects when the element to which the tooltip belongs can appear multiple times: to ensure that the same tooltip text is displayed every time, when an element is displayed assign a specific tooltip object to the element.
The color green always means Released. In order to always display exactly this text as tool tip when a row is green, assign the appropriate tooltip to the color.
The tooltip object contains the following information:
y y y
The type of tooltip object (that is for which element the tooltip can be sued) The indicator for the element The text that is displayed as tooltip
Features You are able to make the following settings for tooltip objects:
y y
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Get Tooltip Object In every main ALV class there is a method that returns all tool tip objects of the ALV output (class CL_SALV_TOOLTIPS). Using this object you obtain the desired tooltip object with the methods GET or GET_TOOLTIP.
Methods Function Get tooltips Class CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE CL_SALV_FUNCTIONAL_SETTINGS CL_SALV_TREE_SETTINGS CL_SALV_TOOLTIPS CL_SALV_TOOLTIPS Method GET_FUNCTIONAL_ SETTINGS GET_TREE_SETTINGS GET_TOOLTIPS GET GET_TOOLTIP
tooltip object
Create, Change and Delete Tooltip Object You are able to create any number of tooltip objects. You are able to delete tooltip objects either individually or all at once.
Methods Function Get tooltip object Delete individual tooltip object Delete all tooltip objects Change the text for the tooltip object Get the text for the tooltip object Get type of tooltip Get indicator for element Class Method CL_SALV_TOOLTIPS ADD_TOOLTIP REMOVE_TOOLTIP CLEAR CL_SALV_TOOLTIP SET_TOOLTIP GET_TOOLTIP GET_TYPE GET_VALUE
The indicator @DL\QToolTip for Icon ABC@ shows the following tooltip:
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:
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure Methods Function Use an F1 help text from another DDIC element Get name of the DDIC element from which the F1 help text has been taken
Display type ALV Tool Simple, two-dimensional table Hierarchical-sequential list Tree structure
Of course the user is also able to print a tree structure. However, you cannot make settings for the printout here with the ALV object model.
No matter which display type you use to display the ALV output on the screen: in the printout, the ALV output is converted to the classic ABAP list (or to a list in the style of the ABAP list) and is printed in this form. Features You can make the following settings for the printout of the ALV output:
y y y y y y
Output additional information Output standard title of the program Determine that the ALV be called in print mode Take actual list size into consideration during printing Optimize Column Width in the Printout Reserve Rows for Event END_OF_PAGE
Output Additional Information In addition to the actual ALV output you are able to output two areas in the printout:
y List information Information as to which filter and which sort are being applied to the ALV output and as to how many data records the ALV output is restricted. y Selection information Information as to which application-specific selection criteria the user used to call the ALV output (for example company code or material number)
If you activate one or both pieces of additional information, the corresponding information blocks are printed before the ALV output. You are able to determine whether a page break should be inserted after these information blocks, thus causing the additional information to appear on a separate page as a cover sheet, or whether the ALV output should be added directly after the additional information.
Methods Function Class Output of list CL_SALV_PRINT information Check whether list information are being output Output selection information Check whether selection information is being output Output additional information on a separate page Check whether additional information is being printed on a separate page
Output Standard Title of the Program The standard title of the program comprises the current date, the title of the ALV output and the page number. You are able to show the standard title.
SET_SELECTIONINFO_ON IS_SELECTIONINFO_ON
SET_COVERPAGE_ON
IS_COVERPAGE_ON
Methods Function Class Method Output standard title of the CL_SALV_PRINT SET_REPORT_
program
Determine that the ALV Be Called in Print Mode
STANDARD_HEADER_ON
You are able to print the ALV output directly without having to first display it on the screen.
Methods Function Print ALV output directly Check whether ALV output is being printed directly Class Method CL_SALV_PRINT SET_PRINT_ONLY IS_PRINT_ONLY
Take Actual List Size into Consideration During Printing You can use the application to determine how wide the list should be in the printout. If the width of the ALV output has changed (for example because the user is showing columns), it can be that the page is not big enough to show all the information. You are able to set that ALV determine the current size before printing and then changes the print parameters accordingly.
Methods Function Take actual list size into consideration during printing Check whether the list size can be adapted Class Method CL_SALV_PRINT SET_PRINT_PARAMETERS_ ENABLED IS_PRINT_PARAMETERS_ ENABLED