Using Cascading Dropdown Boxes
The selection made in a dropdown box is to restrict the values of a dependent dropdown box.
An example would be if you first selected a material group and then, in the dependent dropdown box, you only displayed the Materials(0MATERIAL) for this Material Group(0MATL_GROUP).
If you selected Characteristic Value/Structure Element (CHARACTERISTIC_SELECTION) for the Data Binding Type in the dropdown box Web item, you can use the Affected Data Provider (LINKED_DATA_PROVIDER_REF_LIST) parameter to specify that the dropdown box is to apply the selection to multiple data providers. Define the dependent dropdown box Web items based on separate data providers and add these to the list of affected data providers. This allows you to restrict the data providers using the dropdown box Web item.
If the data for all data providers used here is provided by one query that has the required combinations of characteristic values, for example, in the drilldown for the rows, the required cascading result is achieved.
You can use this approach for two or more dependent dropdown boxes.
For the Access Type for Result Values option for the query, select Posted Values. For more information, see Characteristic Properties → Enhanced tab page.
Include the dependent characteristics in the drilldown for the query in such a way that the dependent characteristic (Material in the example above) to be read is in the rows and also as the second characteristic in the drilldown.
1. Create a query COMBINATIONS that contains the dependent characteristics. In our example, the query is based on the master data for the characteristic Material (0MATERIAL), which contains Material Group (0MATL_GROUP) as attributes.
2. Create two data providers, DP_MASTER and DP_SLAVE, for the query COMBINATIONS.
3. Insert a Dropdown Box (DROPDOWN_SLAVE) Web item into the Web template and select the data provider DP_SLAVE as the data source. Select the dependent characteristics.
4. Insert a Dropdown Box (DROPDOWN_MASTER) Web item into the Web template and select the data provider DP_MASTER as the data source. Select the higher-level characteristic and enter DP_SLAVE and DP_DATA as the dependent data providers.
5. As soon as the selection in the DROPDOWN_MASTER dropdown box changes, the value of the dependent dropdown box, DROPDOWN_SLAVE, is no longer valid and must be deleted or filled with a valid value.
○ Deleting an entry: In the properties for the dropdown box DROPDOWN_MASTER, select the command CLEAR_SELECTION_STATE for the Additional Action parameter (ACTION_WITH_DEFAULT). Select After Default Action as the Execution Point of Time. This deletes the selection for the data providers DP_SLAVE and DP_DATA.
○ Valid value (= first value of the changed results list): The first value from the results list is to be used as the new filter value for the dropdown box DROPDOWN_SLAVE. This is achieved using the SET_SELECTION_STATE command, which is used after the CLEAR_SELECTION_STATE command when an entry is deleted.
Using an expression that follows the XPath notation and that can read values from a data provider, for example, and that can therefore dynamically change parameter values, the first value (changing value) is associated with the command.
Proceed as follows:
i. Create the SET_SELECTION_STATE command as described for deleting an entry. Use the value PLACEHOLDER, for example, as the filter value.
ii. Switch to the XHTML view.
iii. Search for the text value="PLACEHOLDER".
iv. Replace the text with: path="DATA_PROVIDER:DP_SLAVE?/ BICS_VIEW/RESULT_SET/AXES/AXIS[@name="ROWS"]/TUPLES/TUPLE/ELEMENT/MEMBER/@name
This expression assumes that the characteristic to be read (Material 0MATERIAL) is in the rows [@name=’ROWS’] and is the second characteristic in the drilldown [ELEMENT].
6. Test your Web application.
Tip 1: If more data than you are expecting is displayed, this could be because a value other than Posted Values was selected as Access Type for Result Values.
Tip 2: To make the functions more transparent, you can assign an Analysis Web item to each of the data providers DROPDOWN_MASTER and DROPDOWN_SLAVE; this Web item displays the relevant combinations.
7. To complete the example, you require a query that displays data and is restricted using the two dropdown boxes.
Proceed as follows:
a. Create a data provider DP_DATA that references the query QUERY_DATA.
b. In the dropdown box Web items, include the data provider DP_DATA in the list of affected data providers.
c. Include an Analysis Web item that references the data provider DP_DATA.
Example Source Code
Below is the example source code from the XHTML view of the Web Application Designer:
XHTML Example Source Code for Cascading Dropdown Boxes
<bi:bisp xmlns="http://www.w3.org/TR/REC-html40" xmlns:bi="http://xml.sap.com/2005/01/bi/wad/bisp" xmlns:jsp="http://java.sun.com/JSP/Page" >