cancel
Showing results for 
Search instead for 
Did you mean: 

[Resolved] Get element from DropDownByIndex when onSelect event trigger

Former Member
0 Kudos

Hi,

Im having issues to retrieve the right index of the selected item in the DropDownBoxByIndex when onSelect event is trigger.

Without the event this code works well to retrieve the index ...

DATA : v_Element TYPE REF TO if_wd_context_element,

lo_contracttype TYPE REF TO if_wd_context_node,

lo_visibility TYPE REF TO if_wd_context_node,

v_Index TYPE I,

lv_contracttype TYPE ZCUSTCONTRACTTYPE,

itemList TYPE STANDARD TABLE OF IF_CUSTCREATEVIEW=>ELEMENT_contracttype,

w_list LIKE LINE OF itemList.

"retrieve contract type

lo_contracttype = wd_Context->get_Child_Node( wd_this->wdctx_contracttype ).

lo_contracttype->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = itemList ).

v_Index = lo_contracttype->GET_LEAD_SELECTION_INDEX( ).

CLEAR w_list.

READ TABLE itemList INTO w_list INDEX v_Index.

lv_contracttype = w_list-contracttype.

lv_contracttype always contain the default selected value at each onSelect...

I have a dropdownbyindex with only 2 values.

Thanks for your help !

Found ...

Edited by: Benjamin Art on Mar 30, 2011 4:08 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi Benjamin,

I didn't found any thing wrong in ur code.. pls put a break point and check what the index value is getting there.. else try using drop down by key and give the fixed values in domain and call the FM to get the domain values.,

CALL FUNCTION 'RV_DOMAIN_VALUE_TEXTS'

EXPORTING

DOMNAME = 'ZDO_TOSESSION' --> Domain Name

DOMVALUE = temp_domain_value --> domain value ( this u can get directly by get attribute() method not by

get_lead_selection_index() method )

IMPORTING

DDTEXT = domain_value_text. ---> this will give the required domain text.. ie for u contract type.

this is preferable normally in future if u want to add some more values to ur drop down list., no need to change the entire source code u jus can add in the domain value range.

Revert if u need some more clarifications,

Thanks & Regards

Kiran

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Benjamin,

In the onSelect event handler try the following to get the entry selected:

data: lv_index type i.

lv_index = wdevent->get_int( 'INDEX' ).

Regards,

Alex

Former Member
0 Kudos

Benjamin,

On the event handler method of the DDBI onSelect event, you get the following parameters

ID,CONTEXT_ELEMENT,INDEX.

IF you do not have these parameters then change the method and insert these parameters.

You get the selected element in context_element and its index in the node in index parameter. With these parameters you can get the info what you needed.