cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime error occurs when using DropdownByKey

Former Member
0 Kudos

I run into a runtime error when I use the DropDowByKey with fixed value set: the value seletedKey = "001" in DropDownByKey "DDBK_APP_STATE" does not exist in the value list and is not initial either. But I have already added the value pair of the selectedKey using

"NODE_INFO->SET_ATTRIBUTE_VALUE_SET(

NAME = 'APP_STATE'

VALUE_SET = LT_VALUESET )." and I can select it from view. But when I use the attribute bound to the dropdownbykey in select statement as where condition and bind result into table. Before the screen reflash , the error occurs.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please check this forum thread which is similar to your .

Thanks

Suman

Edited by: suman kumar chinnam on Sep 22, 2008 12:03 PM

Answers (3)

Answers (3)

Former Member
0 Kudos

The error implies that the selectedvalue, such as 1, of the 2nd dropdownbykey is not in its value range after fetching the data or other process during this action. When I select the item whose corresponding value = 0, it seems work fine, because 0 is the initial value. Is it possible for the value range of the dropdownbykey to refresh or be cleared at some time in the process?

Former Member
0 Kudos

I have two dropdownbykeys, DROP1(bound to attribute APP_AGENT),DROP2( bound to attribute APP_STATE). Selecting the first will change the content of the other.

The code in the onSelect event of the drop1, which will change the select list of DROP2:

DATA:NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO.

DATA: LT_VALUESET TYPE WDY_KEY_VALUE_TABLE,

L_VALUE TYPE WDY_KEY_VALUE.

NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).

NODE_INFO = NODE_INFO->GET_CHILD_NODE( 'NODE_SEARCH' ).

"**************************set value set for drop down***************

DATA lo_nd_node_search TYPE REF TO if_wd_context_node.

DATA lo_el_node_search TYPE REF TO if_wd_context_element.

DATA ls_node_search TYPE wd_this->element_node_search.

DATA lv_app_agent LIKE ls_node_search-app_agent.

DATA lv_app_state LIKE ls_node_search-app_state.

  • navigate from <CONTEXT> to <NODE_SEARCH> via lead selection

lo_nd_node_search = wd_context->get_child_node( name = wd_this->wdctx_node_search ).

  • get element via lead selection

lo_el_node_search = lo_nd_node_search->get_element( ).

lo_el_node_search->get_attribute(

EXPORTING

name = `APP_STATE`

IMPORTING

value = lv_app_state ).

  • get single attribute

lo_el_node_search->get_attribute(

EXPORTING

name = `APP_AGENT`

IMPORTING

value = lv_app_agent ). -


get the value of DROP1

  • clear the selected value of drop down

lo_el_node_search->set_attribute(

EXPORTING

name = `APP_STATE`

value = '' ).----


I want to clear the selected value of DROP2

IF lv_app_agent IS INITIAL.

L_VALUE-VALUE = 'SUBMIT'.

CLEAR L_VALUE-KEY .

INSERT L_VALUE INTO TABLE LT_VALUESET.

NODE_INFO->SET_ATTRIBUTE_VALUE_SET(

NAME = 'APP_STATE'

VALUE_SET = LT_VALUESET ).

exit.

ENDIF.

CASE lv_app_agent .----


there are 2 cases

WHEN 'SUPP_APP'.

L_VALUE-VALUE = 'APPROVE'.

L_VALUE-KEY = '1'.

INSERT L_VALUE INTO TABLE LT_VALUESET.

L_VALUE-VALUE = 'INITIAL'.

L_VALUE-KEY = '0'.

INSERT L_VALUE INTO TABLE LT_VALUESET.

WHEN OTHERS.

L_VALUE-VALUE = 'APPROVE'.

L_VALUE-KEY = '1'.

INSERT L_VALUE INTO TABLE LT_VALUESET.

L_VALUE-VALUE = 'INITIAL'.

"CLEAR L_VALUE-KEY.

L_VALUE-KEY = '000'.

INSERT L_VALUE INTO TABLE LT_VALUESET.

L_VALUE-VALUE = 'REJECT'.

L_VALUE-KEY = '2'.

INSERT L_VALUE INTO TABLE LT_VALUESET.

ENDCASE.

NODE_INFO->SET_ATTRIBUTE_VALUE_SET(

NAME = 'APP_STATE'

VALUE_SET = LT_VALUESET ).

Then in the another method, I will fetch the value of attribute APP_STATE. I can successfully get the value and put it into where clause and get result. But I will get a runtime error then.

uday_gubbala2
Active Contributor
0 Kudos

Hi Yichao,

Can you please paste the coding in which you are binding the values to your dropdown and the code where you try to fetch from the database.

Regards,

Uday