cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic alv dropdown values

Former Member
0 Kudos

Hello,

I have the ff requirement:

1. Create an Editable ALV.

2. User can enter data by clicking append row or insert row.

     - Take note that the table has no data yet, user will input the data.

3. Most of the columns should have dropdown values.

     - I don't have problems with columns that have same data per row - I used dropdownbykey.

4. Here's the catch, some of the columns are dependent on the data entered in other columns.

     Example: I entered country in one field, I should ONLY be seeing the users under that country in the adjacent field.

     - By this time my context node is still initial because i'm still editing the row.

     How can I achieve this?

     I can't use dropdownbyindex because, as per the posts that I've read, the alv is already populated.
     In my case, I'm yet to populate the ALV.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You could use ON_DATA_CHECK event of ALV and on Insert the event will be triggered, there based on the values in previous column, you can populate the next column.

check this wiki for reference: http://wiki.sdn.sap.com/wiki/display/Snippets/Web%20Dynpro%20ABAP%20-%20ALV%20Controlling%20Standard...

Regards,

Kiran

Former Member
0 Kudos

Yup, but the next column is also a dropdown. These dropdown values vary in every row.

How can I attach those dropdown values in the cell?

Message was edited by: navi l

former_member184578
Active Contributor
0 Kudos

Hi,

Check this thread:

OR, if you use drop down by index, you could use set_valueset_fieldname( ) method, and dynamically populate the values to that attribute.

Regards,

Kiran

Former Member
0 Kudos

I've been trying to use dropdownbykey last night, but it's displaying no values.

Then for the ddbyindex, I guess it's not possible because the node has no existing data to bind with?

ramakrishnappa
Active Contributor
0 Kudos

Hi Navi,

You need to create a child node DRP_DWN_LIST inside the alv data node for drop down list. So that, for each line, you can populate its own set of drop down list values.

For example:

When you add a row into alv, you can prepare the drop down list values for that line  and bind it to the node DRP_DWN_LIST

Check the below thread

dynamic drop down list | SCN

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Thanks Guys for the help!

The links and the advice that you gave are all helpful.

Solution:

1. Make use of the on_data_check event.

2. Refire once again the ALV inside the event on every change of the cell, else the settings that you set (hiding of buttons and fields, editable fields, etc) will got lost.

3. Make use of node->get_static_attributes_table to get all the data in your alv.

4. Make use of the index in R_PARAM->T_MODIFIED_CELLS to update the correct row.

5. Use TYPE_KEY_VALUE instead of TYPE_KEY_CONVERT_TO_VALUE.

6. In the link, it calls lo_interfacecontroller->set_data(xx), do not call it inside the event because your alv will become non-editable.

Answers (0)