cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown in table

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

uday_gubbala2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi

The scenario as mentioned by you all is for initially filling the table using supply function, but in my scenario there will be empty table in the screen and i will fill a column field and then when i press enter the dropdown column should get filled with appropriate set of values.

I tried the approach which you all have mentioed but all the dropdown are getting filled with same values of that of lead selected element in the table.

For example:

There are a, b and c three rows are there. if 'a' is leadselected then all the three appropriate dropdowns in the table are filled with the values of 'a' only.

Please help me in solving this.

Regards,

Sarathy.

Former Member
0 Kudos

Hi Sarathy,

Use the property of cell variants and also supply functions to resolve your issue.Also check sap wiki for webdynpro abap for cell variants.

Hope this helps u..

Thanks,

Vamshi Reddy.

Edited by: vamshi reddy . ch on Dec 15, 2011 11:52 AM

Former Member
0 Kudos

Hi Vamshi,

Actually i have a dropdown field in a table, each dropdown in the rows should have a different set of values. these dropdown should be filled when i enter any values in one of column field in all rows and press enter. I think this cell varient is for using different UI in the column.

Regards,

Sarathy

Former Member
0 Kudos

Create a context attribute VALUESET of type WDR_CONEXT_ATTR* (Please search the table type in Se11) in the node to which the table is bound.

Bind this attribute to the drop down - Valueset property for that column of that table.

Hope you are using the drop down by index for this purpose.

Now for the first time you need to fill like this -

LOOP AT ITAB into wa_tab.

ls_valueset-key = 'X'.
ls_valueset-value = 'X'.
append ls_valueset to lt_valueset.
modify itab from wa_tab transporting VALUESET.
ENDLOOP.

Bind this internal table to the respective node.

Please search for the type WDRCONTEXTATTRVALUELIST....Something like this..

Same logic you need to write on change of the dropdown value ONLEADSELECT event of that dropdown and need to bind that table or that respective element with a little change in the logic.

Hope this is clear.

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

From my understanding your logic is for filling the the dropdown only for leadselected element. But i need all the dropdown in the table to be filled in a single event when i press enter.

As in the Demo program : DEMO_VARIABLE_DROPDOWN. This is filled initially usiing supply function but i want this to happen when any event occurs.

Regards.

Sarathy.

Former Member
0 Kudos

the above code is not for the lead selected one. It applies to all rrecords of the internal table as there is no condition. You have to use the same code in the event of DROPDOWN.

In that column->CELL_EDITOR->DROPDOWn->there is an event for Onleadselect or OnSelect, subsribe to this event and use the same code...then when ever there is a change ion one dropdown the others also gets changed..but you need to moidfy the code as per your conditions Ok....

Hope this is clear.

Former Member
0 Kudos

Hi Lekha,

Sorry my requirement is different.

For ex:

In the table there are 2 columns. Column1 and Column2. Column1 is a input field and Column2 is DropdownIndex.

Initially the table will be empty. In the column1 i will fill values for all rows like below example a, b , c....

Column1

row1

a

coulmn2

row1

x

y

z

Column1

row2

b

coulmn2

row2

m

n

o

So when i click enter the column2 (dropdown) should get filled with x, y, z for corresponding a in column1. and m.n,o.. for b.

Like this each dropdown will have different set of values for each input given in cloumn1.

I want to achieve this.

In this standard one: DEMO_VARIABLE_DROPDOWN. Here supply function is used and this fills the table initially when the table appears first time.

But when i tried the logic in my case. It appears as the below. If 'a' is leadselected all dropdowns are filled with a values and if 'b' is leadselected all the dropdowns are filled with b values.

Here 'a' is leadselected when i click enter event.

Column1

row1

a

coulmn2

row1

x

y

z

Column1

row2

b

coulmn2

row2

x

y

z

Could you please help me in this.

Regards,

Sarathy.

Former Member
0 Kudos

As per your requiremnt, based on the value entered in COL1 and on hit of ENTER ket the respective dropdown for that row needs to be changed right..

please confirm...

Former Member
0 Kudos

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.