What is the ABAP List Viewer (ALV)?
The ABAP List Viewer is a generic tool that can be used to output data in tabular form and is increasingly used by the applications particularly as of Release 4.6C. By using the ALV, general functions are provided (for example, exporting to Excel) and it is possible to adapt the output to customized requirements (for example, sorting, filters, totals calculation).
What different types of ALV are there?
ALV list: this uses the function module
Hierarchical sequential list: function module
Fullscreen grid: this uses the function module
ALV Grid Control: Methods of the class CL_GUI_ALV_GRID
ALV Tree: Methods of the class CL_GUI_ALV_TREE
In Basis Release 6.40, an object-oriented ALV wrapper is provided. This can be used for three different types of tables.
- for simple, two-dimensional tables using the classCL_SALV_TABLE
- for hierarchical sequential tables (class CL_SALV_HIERSEQ_TABLE)
- for tree structures (class CL_SALV_TREE)
How can the ALV be used by customers?
- The methods of the class CL_GUI_ALV_GRID, which are required for an ALV grid that cannot be edited, are released for use in customer-specific programs. The documentation is accessed in the class documentation.
- The object-oriented ALV wrapper, which is provided in Basis Release 6.40, is also released for customers. For more information, see the corresponding class documentation, as well as the sample report SALV*.
- The methods of the classes CL_GUI_ALV_TREE CL_GUI_ALV_TREE_SIMPLE, CL_ALV_TABLE_CREATE and the ALV function modules are not released for use by the customer.
- The class CL_ALV_TABLE_CREATE is not released.
Why do the scroll keys sometimes not work?
The scroll keys do not work in the ALV grid control because the front end and back end have been separated within this control-based technology. As a result, the back end does not have any direct control over the actual display, and the data can no longer be distributed over individual pages. In addition, several 'scrollable' grid objects can be displayed on a screen. Each grid represents a separate object and it is unclear to which of these objects the scroll keys should apply.
Why is the Excel button missing in hierarchical sequential lists?
In the case of hierarchical sequential lists, you cannot use the XXL interface to export data, due to the differences in format between the header line and the item line.
Why is the sort sequence incorrect?
- The sorting in the ALC is always carried out on the basis of the internal values that are saved on the database.
- Fields in which the external display differs from the internal display (conversion exit, for example, for PS_POSNR) therefore appear unsorted in the external display.
- If the fields are sorted according to the external display, then the relevant field domain must be entered in the ASEXDOM table. For all fields on which this domain is based, note that the sorting is converted to the external display; this conversion applies across the system for all ALV outputs.
Is it possible to total different currencies/units of measure?
For hierarchical sequential lists, it is not possible (for technical reasons) to total amounts with different currencies or units of measure. If you total using such a column, an 'X' appears instead of the total.
Within the ALV grid and the single-level list, the different currencies/measures are displayed separately in the totals formation.
When you use wildcards (*) to filter data, you can filter single values. Then all of the values of the output table that correspond to the pattern are filtered (search variable CP, contains pattern).
For areas, you must specify the CP variable for the filter criteria and the variable for restricting the area (BT, between) Due to the interfaces, you are unable to do this. Therefore, you should only filter areas 'from ...until ' with complete values and without wildcards.
Some tips and tricks:
- Sample reports: There are numerous ALV reports that you can use to check the functions of the ALV. These reports all begin with BCALV_TEST_ .... The reports are delivered in Support Packages.
&SOS: To ensure that the ALV displays and functions properly, it is important that the field catalog and output table agree without any errors. The ALV consistency check is provided for this purpose. You can access this check within the list by calling &SOS in the OKCODE field. For the fullscreen and GRID, you can reach it via the print preview and then &SOS, or by holding down the Shift key and simultaneously double-clicking the right mouse button on the empty, gray background of the display.
Selection: In large lists it is useful to restrict the search area by selecting the relevant columns or lines.
By default, the search starts at the cursor position.
For this reason, it is useful to enter the search direction in the search dialog.
You can enter the search term manually.
If you call the search function using the context menu, the value is directly used as a search term.The search term is then searched for and displayed within the selected area in the search direction entered.
Why are the functions for filtering and sorting not available in the ALV tree?
The ALV tree is called with a certain sequence and hierarchy of nodes. This hierarchy is specific and should always be retained. Therefore, the functions for filtering and sorting are not available in the ALV tree.
Why is it not possible to filter with wildcards (*) in columns with conversion exits?
- When you use the filter function in the ALV, conversion exits are taken into account. These conversion exits convert the external value that was entered into the relevant internal value.
- The data table is then filtered with the internal values.
- If you enter a wildcard instead of a correct external value in the filter dialog box, it is unclear which internal value should be matched to this confusing value.
- The conversion exit may return an error message.
The detailed dialog box of a line displays information about the columns that are displayed in the grid, as well as those that are hidden. Therefore, the order of the columns in the detailed dialog box cannot correspond 1:1 with the grid view.
The order of the hidden columns does not correspond to the order in the ALV view.
The hidden columns are included. Their position depends on the changes in visibility and on the order in the "Change layout" dialog, so it may change as a result.
Why is the setting of the summation level drilldown of an ALV Grid (collapsed/expanded) not transferred to the print preview and the refresh on a one-to-one basis?
- Subtotals and the sorting can be transferred only with a value of the summation level drilldown.
- When you expand one of the summation level drilldowns in the grid display, the value of this level is transferred for all other subtotals in the print preview and the refresh.
- If you want to print grids with different subtotal levels, you must expand or collapse individual subtotals in the print preview. When you print this list from the print preview, the specific levels of the individual subtotal levels are retained.
How do I select nodes in the ALV tree?
If you want to select a node, you must select the entire line by clicking the node icon. In the case of selected nodes, the entire line is displayed in yellow. If only the text in the hierarchy column is highlighted in yellow, this does not apply as selected.
The search is performed in the data table transferred to the ALV.
- The subtotals and totals only exist virtually and are not attached to the database table.
- Therefore, the system does not find values in these lines.
- If the summation levels are collapsed, the system counts entries that it finds but does not display them as selected, since an automatic expansion of subtotal levels is not possible for technical reasons. In this case, the search should be performed using the expanded table.