Skip to Content
avatar image
Former Member

Dropdown in table

Hi Experts,

I have a scenario in which i have dropdown in the table column. Here the dropdown in each row should hold different set of values. A node a bounded to the table and one of the attribute of that node is binded to that dropdown in the table. when i use node info for filling the dropdown then the dropdown list in each row got filled with same set of values.

Please any one help me out of this issue.

Regards,

Sarathy.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 08, 2011 at 02:45 PM

    What you can do is to create a child node inside your node ( table data source ). Create a supply function for this child node and bind different value set for each row.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 09, 2011 at 12:04 AM

    Hi Sarathy,

    First of all you need to make use of an DropDownByIndex as the table's cell editor if you intend to achieve this sort of functionality & then you can populate the node by using the approach as suggested by Bhaskaran.

    Try check the standard Web Dynpro Component DEMO_VARIABLE_DROPDOWN. Here they have 2 nodes TABLE_SOURCE (parent node) & URLS (child node). They have assigned a supply function S_TABLE_SOURCE for the parent node TABLE_SOURCE. Within this particular method they are coding the logic to populate the values for both the nodes. The key point to be noted is that here within that supply function they are filling the URLS node with data in such a way that the dropdown in each row contains a different valueset. Execute the DEMO_VARIABLE_DROPDOWN component & observe the values that the dropdowns under the URLs column have in different rows.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      As per my previous posts try to create the context attributes for VALUESET.

      Go to the CELL EDITOR INPUT FIELD of COLUMN1 and subscribe to the ENTER event.

      Now write the below code in this EVENT.

      At a time as only one value is entered for a given row you can still get that record using the WDEVENT parameters of the event where the ROW/RECORD ID will be there.

      Or

      For example the value of COL1 is A, B, C.

      LOOP AT IT_ITAB into WA_ITAB.
      
      CASE WA_ITAB-COL1.
      
      WHEN u2018Au2019.
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Xu2019.
      WA_VALUESET-VALUE = u2018Xu2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Yu2019.
      WA_VALUESET-VALUE = u2018Yu2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Zu2019.
      WA_VALUESET-VALUE = u2018Zu2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      
      WHEN u2018Bu2019.
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Mu2019.
      WA_VALUESET-VALUE = u2018Mu2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Nu2019.
      WA_VALUESET-VALUE = u2018Nu2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      
      CLEAR WA_VALUSET.
      WA_VALUESET-KEY = u2018Ou2019.
      WA_VALUESET-VALUE = u2018Ou2019.
      APPEND WA_VALUESET TO IT_VALUESET.
      WHEN u2018Cu2019.
      ENDCASE.
      WA_ITAB-VALUSET = IT_VALUSET.
      WA_ITAB-COLUMN2 = IT_VALUSET.
      MODIFY IT_TAB FROM WA_ITAB INDEX IDTRANSPORTING COLUMN2.
      ENDLOOP.
      LO_NODE->BIND_TABLE-> (IT_TAB1 ).

      As per the above code, you can see based on the value entered, the dropdown for that row differs. ID is the record that is currently entered by user that can be taken from WDEVENT of onENTER event.

      Hope you have used the SET_ATTRIBUTE_VALUESET method of the IF_WD_CONTEXT_NODE_INFO for COL2 where VALUESET is passed, before you actually use this code.

      Hope this helps.

  • avatar image
    Former Member
    Dec 09, 2011 at 11:09 AM

    Take the different node for that dropdown attribute field and write the logic for getting the values.

    Like take one structure for that attribute and define internal table and workarea as well after that

    write a select query and get the child node and get the node info and then bind the values.

    And then add the column to the table by drag and drop.

    Add comment
    10|10000 characters needed characters exceeded