Filters 
Using filters, you restrict the display of data records in the ALV output. To do this, you specify conditions that a record in a specific field has to fulfill to be displayed or filtered out.
You can make the following settings for filter objects:
Create, get, or delete filter conditions for a field
Make settings for a filter condition
Ignore capitalization
Disallow filters for a column
Filter by the values of another field
Hiding and showing the tab page for filtering or Filter oushbutton in the toolbar
Unlike a sort condition, you can create any number of filter conditions for each field.
Note
You can create a filter condition only for columns for which you have not explicitly disallowed this (see below).
Filtering is a property of a field in the ALV output (see Fields). To create, get, or delete the filter condition of a field, use the methods of interface class IF_SALV_WD_FILTER (implementing class CL_SALV_WD_FIELD).
Methods for creating, getting, and deleting filter conditions
Function |
Method |
Get a specific filter condition |
GET_FILTER_RULE |
Get all filter conditions of a field |
GET_FILTER_RULES |
Create filter conditions |
CREATE_FILTER_RULE |
Delete a specific filter condition |
DELETE_FILTER_RULE |
Delete all filter conditions of a field |
DELETE_FILTER_RULES |
The filter condition of a field is represented by an object of class CL_SALV_WD_FILTER_RULE.
Note
If you assign a new data table with a new structure to your ALV output, all filter conditions for all fields are deleted automatically.
A filter condition consists of the following specifications:
Comparison value for which the rows are checked
This can be an individual value or a range for the given value. You always enter the lower value (LOW_VALUE), and for a range, you also enter an upper value (HIGH_VALUE).
Operator for comparing the field value and the comparison value
Using this specification (OPERATOR), you specify the relationship between the cell value and the comparison value (for example, greater than, less than, or equal to)
Inclusion or exclusion
Using this specification, you specify whether rows that match the condition are displayed, or whether they are not to be displayed at the moment.
To change settings for a filter condition, use the methods of class CL_SALV_WD_FILTER_RULE.
Methods for settings for a filter condition
Function |
Method |
Specify comparison value (lower value) |
SET_LOW_VALUE |
Get comparison value (lower value) |
GET_LOW_VALUE |
Specify upper value of comparison range |
SET_HIGH_VALUE |
Get upper value of comparison range |
GET_HIGH_VALUE |
Specify operator |
SET_OPERATOR |
Get operator |
GET_OPERATOR |
Specify inclusion or exclusion |
SET_INCLUDED |
Get inclusion or exclusion |
GET_INCLUDED |
By default, the filter takes capitalization into account when searching for data records that fulfill the filter conditions. When you enter the comparison value, you must therefore enter the value with exactly the right capitalization to obtain the required results.
You can make a setting so that the filter ignores the capitalization. To do this, you use the methods of interface class IF_SALV_WD_FIELD_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for capitalization
Function |
Method |
Ignore capitalization |
SET_FILTER_IGNORING_CASE |
Check whether capitalization is ignored |
IS_FILTER_IGNORING_CASE |
You can explicitly disallow filters for a field. This has the following effects:
If an ALV output is filtered, a filter row is automatically displayed in which you can see the filters currently set for each column. The user can quickly enter a filter here.
If you disallow filtering for a field, the corresponding cell in the filter row is empty and cannot be filled.
In the Settings dialog box, on the Filters tab page, the corresponding column is not longer available.
If you defined a filter condition for this field in your application, the filter in the ALV output has no effect.
To disallow filtering for a field, use the methods of interface class IF_SALV_WD_FILTER (implementing class CL_SALV_WD_FIELD).
Methods for disallowing filtering
Function |
Method |
Disallow filtering for a field |
SET_FILTER_ALLOWED |
Check whether filtering is allowed |
IS_FILTER_ALLOWED |
You can specify a field according to which the current field is to be filtered if the field does not return the required result or requires overly complicated input. To do this, you use the methods of interface class IF_SALV_WD_COLUMN_SERVICE_REF (implementing class CL_SALV_WD_COLUMN).
Methods for filtering using the values of another field
Function |
Method |
Specify field name of another field |
SET_FILTER_FIELDNAME |
Get field name of another field |
GET_FILTER_FIELDNAME |