cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdownbykey in table

Former Member
0 Kudos

hi,

I want use the dropdownbykey in table. when the value changed, i will get the

element of the context, and update the other field value.

how can i get the element in the action method of the dropdownbykey UI element

?

Thank you for your help!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

... if i understand you right for example by getting the lead selection of your table and then accessing the field.

structure_of_your_table type TYPE IF_yourview=>ELEMENT_ýournodename_of_the_table,

LO_NODE type ref to IF_WD_CONTEXT_NODE,

LO_LEAD_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT,

  • obtain current lead selection

LO_NODE = WD_CONTEXT->GET_CHILD_NODE( IF_yourview=>WDCTX_yournodename_of_the_table ).

LO_LEAD_ELEMENT = LO_NODE->GET_LEAD_SELECTION( ).

if LO_LEAD_ELEMENT is bound.

LO_LEAD_ELEMENT->GET_STATIC_ATTRIBUTES( importing STATIC_ATTRIBUTES = structure_of_your_table).

endif.

CASE structure_of_your_table-your_dropdownfield.

WHEN .....

ENDCASE.

Regards,

Volker

Former Member
0 Kudos

hi, Volker

Thank you for your answer!

Problem is when i fire the action of dropdownbykey, there is not the lead

selection in table.

Former Member
0 Kudos

Hi!

1. Why?

2. did you have a look at sample applications WDR_TEST_TABLE and/or WDR_TEST_EVENTS?

Regards,

Volker

Former Member
0 Kudos

This is my source code in ON_SELECT action of DropDownbykey

data:

text type string,

element type ref to if_wd_context_element,

node_it_result_data TYPE REF TO IF_WD_CONTEXT_NODE,

key type string.

key = wdevent->get_string( 'KEY' ).

node_it_result_data = wd_context->get_child_node( 'IT_RESULT_DATA' ).

element = node_it_result_data->get_lead_selection( ).

element->set_attribute( name = 'TIME_AREA' value = key ).

Former Member
0 Kudos

Hi,

In your code, do not use the method get_lead_selection. This will return you only the lead selection, which will mostly be different from the row which you have selected for the drop down.Use the following command instead:

element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

Then do a get_static_attributes to get the data and subsequently, do element->set_attribute( ) to set the values. Use the get_context_element exactly as I have given, do not change the parameter.

Regards

Nithya

Former Member
0 Kudos

Hello Pei,

You should call wd_event->get_context_element( 'CONTEXT_ELEMENT') to find the corresponding element for which drop down was selected.

Regards,

Neha

Answers (1)

Answers (1)

Former Member
0 Kudos

You can read the context which is bound to your dropdown key element.

Here Land1 is the drop down element. At the runtime i am reading this value and updating other field.

Node_Vend_Add1 = wd_Context->get_Child_Node( Name = wd_This->wdctx_Vend_Add1 ).

  • get element via lead selection

Elem_Vend_Add1 = Node_Vend_Add1->get_Element( ).

  • get single attribute

Elem_Vend_Add1->get_Attribute(

exporting

Name = `LAND1`

importing

Value = Item_Land1 ).