cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Dynamic Drop downs in ALV Columns

Former Member
0 Kudos

Hi All,

I want to create dropdowns in one of the ALV columns. Each entry is populated dynamically and has different values.

I tried the following

1. Populated the attribute value set for the column attribute for each entry (row) in the table and bound the table to ALV. (Drop down by key)

Prob - This is adding up all the values to the attribute and showing up the same values for all the dropdowns

2. Used an extra attribute (thats not part of the table) and populated the value set. Used this attribute to bind the values to each dropdown using set_valueset_fieldname method (in CL_SALV_WD_UIE_DROPDOWN_BY_IDX)

(Drop down by Index)

Prob - I see no values at all in the drop downs

Any help is highly appreciated.

Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Sri,

what you need to do is to bind non-singleton sub-nodes of the node that you are using for the table to the dropdowns - thus each line (element) of the table will have access to its own context node.

I've not done this using ALV - I'm not even sure it is possible - but I have done it using a normal WD table - and it works very well.

Hope this helps,

Cheers,

Chris

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You shouldn't have subnodes to the node bound to the ALV. From the online help:

Here ALV has to use the entire dataset so that the data records can be arranged in the new order. For this purpose, the ALV component temporarily takes control of the internal data table and invalidates the corresponding context node of your application during this time. This ensures that the application cannot access the context node while the ALV component is editing the internal data table.

This ensures that the internal data table is never copied. This is important because large volumes of data would considerably impact performance and memory space.

When you are planning your application, note the following side-effects of this mechanism:

● When the context node is invalidated, information about current selections, and in particular the lead selection, is lost.

● If your application has created subnodes for the context node, (master-detail scenario), these subnodes are lost as soon as the ALV component invalidates the context node. If the application then tries to access the subnodes, a runtime error occurs.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/b9ea094f4a3118e10000000a1553f7/frameset.htm

ChrisPaine
Active Contributor
0 Kudos

That's a shame!

Does this mean that using a drop down by index in an ALV is limited to having the same dropdown in every row of the table (it would certainly seem that this is the case).

Cheers,

Chris

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> That's a shame!

>

> Does this mean that using a drop down by index in an ALV is limited to having the same dropdown in every row of the table (it would certainly seem that this is the case).

>

> Cheers,

>

> Chris

I would assume so as I can't think of a way around the subnode limitation. The system will actually allow you to have a subnode and everything works fine until you sort the ALV - then you get a short dump.

I suppose you would have to fall back to using a regular table in this case.

Former Member
0 Kudos

>

> >

> > That's a shame!

> >

> > Does this mean that using a drop down by index in an ALV is limited to having the same dropdown in every row of the table (it would certainly seem that this is the case).

> >

> > Cheers,

> >

> > Chris

>

> I would assume so as I can't think of a way around the subnode limitation. The system will actually allow you to have a subnode and everything works fine until you sort the ALV - then you get a short dump.

>

> I suppose you would have to fall back to using a regular table in this case.

But how come the class documentation says its possible.

Functionality

Using class CL_SALV_WD_UIE_DROPDOWN_BY_IDX, you make all the settings for the UI element index-based dropdown list box, from which the user can select from a range of values.

*You use the index-based dropdown list box if the dropdown list boxes in each cell of the column are to contain different entries.*

You use the key-based dropdown list box if the dropdown list boxes in each cell of the column are to contain the same entries.

To specify the entries in the dropdown list boxes, the context of your application requires an attribute for which the data type satisfies the following requirements:

The attribute is a table

The structure of this table contains at least one KEY column and a VALUE column.

Note

We recommend that you use the type WDY_KEY_VALUE_TABLE here.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>But how come the class documentation says its possible.

It doesn't really seem like both can be correct. I've experienced the short dumps upon sort that current when I use the child nodes of a context bound to the ALV. All I can say is to try it and see what happens. Perhaps the DDLBByIndex uses the child context nodes in such a way that the invalidation of the parent isn't disruptive (although I'm not sure how that would work).

Former Member
0 Kudos

Hi everyone,

I finally resolved it using an article on saptechnical. I cannot post the link here.

However, I see the first value repeated after all the entries in the drop-down. There are no duplicates in the value set though.

I have deleted all the duplicates.

e.g. US

Canada

India

US

Edited by: Sri on Apr 22, 2010 6:56 PM

Edited by: Sri on Apr 22, 2010 6:57 PM

Former Member
0 Kudos

Resolved.

After populating the dropdown, I set a value (default/initial) for the attribute. This resolved the duplicates.

Thanks.,

Sri