on 02-01-2011 2:44 PM
Hello,
In my component controller i populated my node. ( i am seeing the value in my view)
here the code for the population:
********************************************************
lo_context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
lo_context_node->bind_table( tl_habili ).
*********************************************************
I am trying now to read its values.
i tried to proceed as flowing but i am getteing : Access via 'NULL' object reference not possible
and my context_element is always initail when i debug.
*************************************************************************
context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
context_element = context_node->get_element( ).
context_element->get_attribute( EXPORTING name = `YSTRUCT` IMPORTING value = lv_ystruct ).
*****************************************************************************
I also tried to read it as table ( i have the right cardinality) but my table is always empty.
*************************************************************************
context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
context_node->get_static_attributes_table( IMPORTING table = lt_user_parofile ).
***************************************************************************
Does somebody has a clue?
i am still new at webdynpro abap.
Thanks in advance.
Put a breakpoint at the bind statement and see whether the table is having the rows in it when you are binding it.
and as Lekha pointed out try to fetch value using index number.
but i guess that will also throw error as you are not having any elements in the node.
so check the values on the table that you are binding to the node for filling it.
thanks
sarbjeet singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
context_element = context_node->get_element( ).
Change to
context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
context_element = context_node->get_element( index = 3 ). "it will return the row at 3rd index... you need to specify the index or ther eis other method GET_LEAD_SELECTION() method of the if_wd_context_node..which returns the lead selected row..
Always try to check if the referene is bound or not to avoid such dumps
context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
if context_node is bound.
context_element = context_node->get_element( ).
endif.
if context_element is bound.
context_element->get_attribute( EXPORTING name = `YSTRUCT` IMPORTING value = lv_ystruct ).
endif.
Before binding the table have you checked weteher the table is empty or not. Check in debugging.
If you still see some problems, check the table sturture and the Node sturcuture that you are trying to populate to BIND TABLE method.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Iit is always a best pratice tp check if the references are bound or not intiiall...
they are not bound....when there is no data that is required to create that object reference..might be some pre-requisties / mandatory thinds required to careate that object,
In your case, as there is no data in the table or no data in node....there are no elements..when you try to use GET_ELEMENT it doesnot know to whcih it refers..as there is no data...Hence You get the NULL reference exception.
Regards,
Lekha.
in my controler
i populate my node as following
GET User Profile
SELECT SINGLE *
FROM ysr_tabl_habili
INTO l_habili
WHERE nni = sy-uname
AND yfmp = 'X'.
append l_habili to tl_habili.
IF sy-subrc EQ 0.
lo_context_node = wd_context->get_child_node( name = wd_this->wdctx_user_parofile_node ).
lo_context_node->bind_table( tl_habili ).
ENDIF.
and in debugging mode my tl_habili is not empty.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
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.