cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown - issue with passing values to context

Former Member
0 Kudos

Hi,

After facing issue in:

Now I've encountered another problem. Dropdown is created in alv, however once user select value from the list it shows selected value in the cell, however value in context remains unchanged.

Here is the way I implemented dropdown:

1) I added new field to the structure which is shown in the alv FIELD1 of WDR_CONTEXT_ATTR_VALUE_LIST type.

2) I initialize the column, where dropdown is supposed to be:

- first column

l_col_name = 'COL1'.

lr_column = lr_model->if_salv_wd_column_settings~get_column( l_col_name ).

DATA: lr_drdn_by_idx_col1 TYPE REF TO cl_salv_wd_uie_dropdown_by_idx.

CREATE OBJECT lr_drdn_by_idx_col1 EXPORTING selected_key_fieldname = l_col_name.

lr_drdn_by_idx_col1->set_valueset_fieldname( value = 'FIELD1' ).

lr_drdn_by_idx_col1->set_read_only( value = abap_false ).

lr_drdn_by_idx_col1->set_type( if_salv_wd_c_uie_drdn_by_index=>type_key_value ).

lr_column->set_cell_editor( lr_drdn_by_idx_col1 ).

3) I load the data,

Piece of code loading data into structure with dropdown:

DATA: ls_valueset TYPE wdr_context_attr_value,

lt_itab LIKE TABLE OF ls_line.

ls_valueset-value = 'KG'.

ls_valueset-text = 'KG'.

APPEND ls_valueset TO lt_itab[].

ls_valueset-value = 'ST'.

ls_valueset-text = 'ST'.

APPEND ls_valueset TO lt_itab[].

  • zstructure is type of the row show in the alv

Data:

ls_po_result TYPE zstructure.

lt_po_result TYPE table of zstructure.

...

ls_po_result-FIELD1[] = lt_itab[].

....

APPEND ls_po_result TO lt_po_result[].

Everything works so far good. The thing is that once I changed value from e.g. ST to KG, value in Attribute COL1 is still ST.

I would appreciate your help,

kind regards,

Adam

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

it seems that after update with note 1013587 all dropdown-issues has been fixed

regards,

Adam

Former Member
0 Kudos

Hi Adym.

Good to hear. Please marks this thread as answered to close it.

Cheers,

Sascha

Former Member
0 Kudos

Hi Adam,

In the loading the values part, where are you binding the value set to the context attribute FIELD1? I do not see it in your code.

Otherwise, your code looks fine, and as I mentioned in the previous thread, this works for me. Could it be yet another issue with the SP that you are in?

Regards

Nithya

Former Member
0 Kudos

Hi Nithya,

it could another issue with the SP, I will inform you if it's the case.

Passing values comes up with function when I load data into alv.

structure_name - alv columns structure

DATA: l_name1 TYPE t001w-name1,

ls_po_result TYPE structure_name

lt_po_result TYPE table of structure_name,

  • load data from DB into l_itab

....

LOOP l_itab AT ASSIGNING item.

  • this method return value_set to field1

CALL METHOD fill_single_dd

EXPORTING

i_id = item-id

IMPORTING

rt_dd_table = ls_po_result-field1[].

APPEND ls_po_result TO lt_po_result[].

ENDLOOP.

  • binding to node ....

Former Member
0 Kudos

Hi Adam.

I guess the problem is with the selected key name:

CREATE OBJECT lr_drdn_by_idx_col1 EXPORTING selected_key_fieldname = l_col_name.

You have to set it to the name of the attribute the column is bound to. FIELD1 ???

Furthermore do not use the brackets []. These are not necessary.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Former Member
0 Kudos

Hi Sascha,

thanks for your reply.

FIELD1 contains list of values for dropdown.

COL1 is column where the dropdown should be shown and where the values from dropdown should be passed to.

Both are attributes of the same node.

In this case Is it correct?

CREATE OBJECT lr_drdn_by_idx_col1 EXPORTING selected_key_fieldname = 'COL1'.

lr_drdn_by_idx_col1->set_valueset_fieldname( value = 'FIELD1' ).

regards,

Adam

Former Member
0 Kudos

I would try:

CREATE OBJECT lr_drdn_by_idx_col1 EXPORTING selected_key_fieldname = 'FIELD1'.

But this is just a guess.

Former Member
0 Kudos

Hi Sascha,

I've just tried this:

CREATE OBJECT lr_drdn_by_idx_col1 EXPORTING selected_key_fieldname = 'FIELD1'.

I got an error:

The ASSERT condition was violated.

Probably it's my mistake, I mean I haven't explained the issue good enough.

regards,

Adam

Former Member
0 Kudos

hi,

To bind the value to the context node you just need to do in this way

node->bind_table( <table name>).

this should be enough for your problem

cheers