cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown By Key or Index In A Table With Different Values

Former Member
0 Kudos

Hi Experts,

Could some one plz tell me how we can create a dropdown by key or a dropdown by index in a table

with completely different set of values in each row of the table, i am aware of haow to create dropdown cell editors in a table but i am stuck with passing different values at each row level.

Your Responses would be acknowledged,

Chaitanya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use drop down by Index and take a variable of type the valueset and fill the valuesets

different for each row. Bind this valueset by getting the column references of the table.

Create a attribute in the node as VALUESET of type WDR_CONTEXT_ATTR_VALUE_LIST to which the table is bound.

Now fill the valueset -

DATA:
ls_value_set     TYPE        wdr_context_attr_value.
loop at lt_final into ls_final.

***For each row based on condition fill the valueset.
        ls_value_set-text  = space.
        INSERT ls_value_set INTO TABLE ls_final-valueset.
        ls_value_set-value = space.
        ls_value_set-text  = '1'.
        INSERT ls_value_set INTO TABLE ls_final-valueset.
append ls_final to lt_final1.
clear ls_final.
endloop.

lt_final1 bind to the table.


Now get the column references of the node to which table is bound.

DATA: lr_node type ref to if_wd_context_node,
          lr_info type ref to if_wd_context_node_info.

  lr_node = wd_context->get_child_node( 'FINAL' ).
   lr_info = lr_node->get_node_info( ).

Use GET_COLUMNS of cl_wd_table to get column references.
declare a dropdown index element.
loop at the lt_columns into lr_cols.

when 'colname'.
          CREATE OBJECT lr_drp_idx
            EXPORTING
              selected_key_fieldname = lv_id. "column name
          lr_drp_idx->set_texts( 'VALUESET'   ). "Attribute name of the node
         or set_on_select to bind the valuset attribute
          lr_cols->set_cell_editor( lr_drp_idx ).
endloop.

Like this you can fill different valuesets for each row.

Regards,

Lekha.

Answers (3)

Answers (3)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Dropdown By Key is not of use in this case, Dropdown by Index is very much helpful for this kind of information.

just go through the UI element in WDR_TEST_EVENTS component

Abhi

Former Member
0 Kudos

Thanks a lot all you guys what would happen to us newbies without you ppl

Chaitanya.

alejandro_bindi
Active Contributor
0 Kudos

You need to use a DropDownByIndex in that case. You can use the simpler DropDownByKey when you need the same values on each dropdown regardless of the table row.

For populating a DropDownByIndex subnode, you can use a supply function.

Here you have more details (you can also search this forum): http://help.sap.com/saphelp_erp2005/helpdata/EN/dd/b0884118aa1709e10000000a155106/content.htm

Quoting:

If you want to create a table with dropdown lists, whereby each table row can have different values in its dropdown list, you should use DropDownByIndex.

...

You can find examples of this interface element in the system in the Web Dynpro application WDR_TEST_UI_ELEMENTS, and in the component WDR_TEST_EVENTS in the view DropDownByIdx.

Former Member
0 Kudos

Hi Chaitanya,

I have a suggestion which can be helpful ( not sure though ).

You can repopulate the dropdowns on the OnLeadSelect event of the table.

This will let you present different dropdown values as per the row selected.

I hope it helps.

Please revert back in case of issues.

Regards,

Sumit