on 04-15-2011 9:03 AM
Hi,
I have a table with one column as dropdown by index.
On action of dropdown select, the code written to get the index of changed element where dropdown was clicked I am getting runtime error Element Is not (or No Longer) Bound to a Node.
In debugging I have checked the CONTEXT_ELEMENT doesnu2019t have node info available
Code where it fails lr_element->get_index().
DATA: lr_element TYPE REF TO if_wd_context_element.
DATA: ld_index TYPE i.
lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
IF lr_element IS BOUND.
ld_index = lr_element->get_index( ).
ENDIF.
Scenario:
Table UI in view Review_View
Context Binding: Node MEAL_INFO (cardinality 0 u2013N, Selection 0-1) which is based on Structure YTE_FTPT_MEAL .
Database Table: Data get stored in YTE_FTPT_MEAL
Table has following Columns
City (Dropdown)
No_of_Days (input field)
Rate (input filed)
Currency (Input filed)
Values of city to be populated in dropdown are maintained in backend table YTE_MEAL_RATES. It has following fields
Cityc City Code
Cityt City Text
Rate Rate
Currency Currency.
On selection of city (from dropdown) I have to populate rate and currency from this table.
Code:
I have taken editor for city as Dropdown by index.
Added a node DD_MEAL_CITY (cardinality 0 -N Selection 0-1) under node MEAL_INFO.
DD_MEAL_CITY:
1.Has two attributes Cityc and Ctiy from dictionary structure YTE_FTPT_MEAL.
2.Supply Function named City.
Code for Supply Function City is
TYPES: BEGIN OF ty_meal_city,
cityc TYPE yte_ftpt_meal-cityc,
city TYPE yte_ftpt_meal-city,
END OF ty_meal_city.
DATA: lt_meal_city TYPE STANDARD TABLE OF ty_meal_city,
lwa_meal_city TYPE ty_meal_city.
SELECT cityc cityt FROM yte_meal_rates INTO TABLE lt_meal_city ORDER BY cityt.
INSERT lwa_meal_city INTO lt_meal_city INDEX 1.u201Dto add blank row
* bind all the elements
node->bind_table(
new_items = lt_meal_city
set_initial_elements = abap_true ).
Code written in INIT method to populate data already stored in backend is
DATA lo_nd_meal_info TYPE REF TO if_wd_context_node.
DATA lo_el_meal_info TYPE REF TO if_wd_context_element.
DATA lo_el_meal_info1 TYPE REF TO if_wd_context_element.
DATA ls_meal_info TYPE wd_this->element_meal_info.
DATA lt_meal_info TYPE STANDARD TABLE OF YTE_FTPT_MEAL.
DATA lwa_meal_info LIKE LINE OF lt_meal_info.
lo_nd_meal_info = wd_context->get_child_node( name = wd_this->wdctx_meal_info ).
SELECT * FROM yte_ftpt_meal INTO TABLE lt_meal_info
WHERE pernr = wd_assist->gs_common_rfc_input-employee_number
AND reinr = wd_assist->gs_common_rfc_input-trip_number.
IF lt_meal_info IS NOT INITIAL.
lo_nd_meal_info->bind_table( EXPORTING new_items = lt_meal_info ).
ENDIF.
Please guide what is wrong or suggest some other approach to achieve required .
Regards,
Madhvika
Edited by: Madhvika Joshi on Apr 15, 2011 4:03 AM
Edited by: Madhvika Joshi on Apr 15, 2011 4:05 AM
Itu2019s resolved. The problem was in WDDOBEFOREACTION action method, the node elements where fetched and some operations were performed and the binding was done again to the node.
WDDOBEFOREACTION method will always be called before the on select method of dropdown.
Since already the elements were modified and binded again in WDDOBEFOREACTION method, the CONTEXT_ELEMENT was not bounded to node and reason for error message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the error message is clearly saying the elements are not bound to the node and you are trying to access the node.
i.e. you have not bound your element to the node.
You didn't provide your entire context tree / method implementation, so I can only take guesses, but your element doesn't seem to be bound to a node (which it should be).
regards, Lukas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.