Show TOC

 Using Cascading Dropdown BoxesLocate this document in the navigation structure

Use

The selection made in a dropdown box is to restrict the values of a dependent dropdown box.

Tip

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.

Prerequisites

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.

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

      1. Create the SET_SELECTION_STATE command as described for deleting an entry. Use the value PLACEHOLDER, for example, as the filter value.
      2. Switch to the XHTML view.
      3. Search for the text value="PLACEHOLDER".
      4. Replace the text with: path="DATA_PROVIDER:DP_SLAVE?/ BICS_VIEW/RESULT_SET/AXES/AXIS[@name="ROWS"]/TUPLES/TUPLE[1]/ELEMENT[2]/MEMBER/@name
        Note

        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[2]].

  6. Test your Web application.
    Note

    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:

    1. Create a data provider DP_DATA that references the query QUERY_DATA.
    2. In the dropdown box Web items, include the data provider DP_DATA in the list of affected data providers.
    3. 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" >     <html >         <head >             <title >NetWeaver BI Web Application</title>             <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         </head>         <body >             <bi:QUERY_VIEW_DATA_PROVIDER name="DP_DATA" >                 <bi:INITIAL_STATE type="CHOICE" value="QUERY" >                     <bi:QUERY value="QUERY_DATA" text="Query data" />                 </bi:INITIAL_STATE>             </bi:QUERY_VIEW_DATA_PROVIDER>             <bi:QUERY_VIEW_DATA_PROVIDER name="DP_MASTER" >                 <bi:INITIAL_STATE type="CHOICE" value="QUERY" >                     <bi:QUERY value=" COMBINATIONS " text="Combinations" />                 </bi:INITIAL_STATE>             </bi:QUERY_VIEW_DATA_PROVIDER>             <bi:QUERY_VIEW_DATA_PROVIDER name="DP_SLAVE" >                 <bi:INITIAL_STATE type="CHOICE" value="QUERY" >                     <bi:QUERY value="COMBINATIONS" text="Combinations" />                 </bi:INITIAL_STATE>             </bi:QUERY_VIEW_DATA_PROVIDER>             <bi:TEMPLATE_PARAMETERS name="TEMPLATE_PARAMETERS" />             <p >                 <bi:DROPDOWN_ITEM name="DROPDOWN_ITEM_1" designheight="70" designwidth="200" >                     <bi:DATA_BINDING_TYPE type="CHOICE" value="CHARACTERISTIC_SELECTION" >                         <bi:CHARACTERISTIC_SELECTION type="COMPOSITE" >                             <bi:DATA_PROVIDER_REF value="DP_MASTER" />                             <bi:CHARACTERISTIC value="0MATL_GROUP" text="" />                             <bi:LABEL_VISIBLE value="X" />                             <bi:ALL_VALUES_ENTRY_INCLUDED value="" />                             <bi:LINKED_DATA_PROVIDER_REF_LIST type="ORDEREDLIST" >                                 <bi:LINKED_DATA_PROVIDER_REF index="1" value="DP_SLAVE" />                                 <bi:LINKED_DATA_PROVIDER_REF index="2" value="DP_DATA" />                             </bi:LINKED_DATA_PROVIDER_REF_LIST>                             <bi:ACTION_WITH_DEFAULT type="CHOICE" value="INSTRUCTION_WITH_DEFAULT" >                                 <bi:INSTRUCTION_WITH_DEFAULT type="COMPOSITE" >                                     <bi:EXECUTION_TIME value="AFTER" />                                     <bi:INSTRUCTION >                                         <bi:CLEAR_SELECTION_STATE >                                             <bi:TARGET_DATA_PROVIDER_REF_LIST type="ORDEREDLIST" >                                                 <bi:TARGET_DATA_PROVIDER_REF index="1" value="DP_SLAVE" />                                                 <bi:TARGET_DATA_PROVIDER_REF index="2" value="DP_DATA" />                                             </bi:TARGET_DATA_PROVIDER_REF_LIST>                                             <bi:CHARACTERISTIC value="0MATERIAL" text="" />                                         </bi:CLEAR_SELECTION_STATE>                                         <bi:SET_SELECTION_STATE_SIMPLE >                                             <bi:TARGET_DATA_PROVIDER_REF_LIST type="ORDEREDLIST" >                                                 <bi:TARGET_DATA_PROVIDER_REF index="1" value="DP_SLAVE" />                                                 <bi:TARGET_DATA_PROVIDER_REF index="2" value="DP_DATA" />                                             </bi:TARGET_DATA_PROVIDER_REF_LIST>                                             <bi:CHARACTERISTIC value="0MATERIAL" text="" />                                             <bi:RANGE_SELECTION_OPERATOR type="CHOICE" value="EQUAL_SELECTION" >                                                 <bi:EQUAL_SELECTION type="CHOICE" value="MEMBER_NAME" >                                                     <bi:MEMBER_NAME path="DATA_PROVIDER:DP_SLAVE?/ BICS_VIEW /RESULT_SET/AXES/AXIS[@name='ROWS']/TUPLES/TUPLE[1]/ELEMENT[2]/MEMBER/@name" />                                                 </bi:EQUAL_SELECTION>                                             </bi:RANGE_SELECTION_OPERATOR>                                         </bi:SET_SELECTION_STATE_SIMPLE>                                     </bi:INSTRUCTION>                                 </bi:INSTRUCTION_WITH_DEFAULT>                             </bi:ACTION_WITH_DEFAULT>                         </bi:CHARACTERISTIC_SELECTION>                     </bi:DATA_BINDING_TYPE>                 </bi:DROPDOWN_ITEM>                 <bi:DROPDOWN_ITEM name="DROPDOWN_ITEM_2" designheight="70" designwidth="200" >                     <bi:DATA_BINDING_TYPE type="CHOICE" value="CHARACTERISTIC_SELECTION" >                         <bi:CHARACTERISTIC_SELECTION type="COMPOSITE" >                             <bi:DATA_PROVIDER_REF value="DP_SLAVE" />                             <bi:CHARACTERISTIC value="0MATERIAL" text="Currency" />                             <bi:LABEL_VISIBLE value="X" />                             <bi:ALL_VALUES_ENTRY_INCLUDED value="" />                             <bi:LINKED_DATA_PROVIDER_REF_LIST type="ORDEREDLIST" >                                 <bi:LINKED_DATA_PROVIDER_REF index="1" value="DP_DATA" />                             </bi:LINKED_DATA_PROVIDER_REF_LIST>                             <bi:ACTION_WITH_DEFAULT type="CHOICE" value="INSTRUCTION_WITH_DEFAULT" >                                 <bi:INSTRUCTION_WITH_DEFAULT type="COMPOSITE" />                             </bi:ACTION_WITH_DEFAULT>                         </bi:CHARACTERISTIC_SELECTION>                     </bi:DATA_BINDING_TYPE>                 </bi:DROPDOWN_ITEM>                 <bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_1" designwidth="400" designheight="200" >                     <bi:DATA_PROVIDER_REF value="DP_DATA" />                 </bi:ANALYSIS_ITEM>         </body>     </html> </bi:bisp>