cancel
Showing results for 
Search instead for 
Did you mean: 

Null Onject Error while bindind view's itab to Component controller

Former Member
0 Kudos

Hi Friends ,

I have 3 view . First view Table_V , Second view Attr_V and third Add_Appr_V .

Now I have table on first view .I am selecting row of table and on click of button I want navigate to Attr_V . The row selected in table of first view should be seen on Second view . I have addressed this by adding element in Context of comp. controller so that I can Access them on Second View .

Now in similar way I want that Aginst Row selected lets say 01s1 I want maintain some 10 costcenter .For that I have taken ND_BUFFER_VALUE in comp. Controller .

ND_BUFFER_VALUE (0...N)

| -


SELECTED_REL_NO ( element )

|----


ND_COST_CENT (0..N) ( Lead selection flag = off , Sigleton = off )

|----


COST_CENT

.....................................Code I wrote -


node_nd_sel_costcent->get_static_attributes_table( IMPORTING table = itab_nd_sel_costcent ).

                                                                    • Putting it in Component Controller Context

DATA:

node_nd_buffer_value TYPE REF TO if_wd_context_node,

node_nd_cost_cent TYPE REF TO if_wd_context_node,

elem_nd_cost_cent TYPE REF TO if_wd_context_element,

stru_nd_cost_cent TYPE wd_this->element_nd_cost_cent..

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

node_nd_buffer_value = wd_context->get_child_node( name = wd_this->wdctx_nd_buffer_value ).

  • navigate from <ND_BUFFER_VALUE> to <ND_COST_CENT> via lead selection

node_nd_cost_cent = node_nd_buffer_value->get_child_node( name = wd_this->wdctx_nd_cost_cent ).

<u><i><b>node_nd_cost_cent->Bind_Table( New_Items = itab_nd_sel_costcent

Set_Initial_Elements = Abap_True ).</b></i></u>

Now I am getting

<b> Access via 'NULL' object reference not possible.</b>

for this Bind_table line .Where am I wrong ?

Point will rewarded .

Thanks in advance .

Accepted Solutions (1)

Accepted Solutions (1)

S-H
Active Participant
0 Kudos

Hi Parry,

This error comes when ND_BUFFER_VALUE is of cardinality 0..N and no element(s) are present for this node. when we try to access the child node of the node which does not have the element(s) it dumps.

One of the solution is to make the node ND_BUFFER_VALUE to cardinality 1..n and set the Lead selection flag = on.

after making this settings dump will not comes since there will be an element in the root elemet of cost center and we can bind the elements.

Another possibility is to place this cost_center node under the root node 'CONTEXT' (by default node comes with WD) with the same settings like 0..n cardinality and Lead selection flag = off then it works (means binding works since the root node is always have an element).

best regards,

Suresh

Answers (1)

Answers (1)

Former Member
0 Kudos

I need more clarity for the same