cancel
Showing results for 
Search instead for 
Did you mean: 

error in navigationlist UI element

former_member474221
Participant
0 Kudos

Hi

i m working on navigation list UI element and onselct event of that I need to transfer the selected record from the navigation list to another table UI element

method for Onselect of navigationlist UI is as follows

METHOD onactionget_details .

DATA lo_componentcontroller TYPE REF TO ig_componentcontroller.

DATA ls_navi_list TYPE wd_this->element_navi_list.

data CONTEXT_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT.

  • Get key information for selected navigation list entry

context_element->get_static_attributes(

IMPORTING

static_attributes = ls_navi_list ).

  • Get related flights

lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).

lo_componentcontroller->get_flights(

iv_carrid = ls_navi_list-carrid

iv_connid = ls_navi_list-connid ).

ENDMETHOD.

i am getting a error "Access via NULL reference object not possible "

when debugger reaches below point.

context_element->get_static_attributes(

IMPORTING

static_attributes = ls_navi_list ).

Edited by: hema T on Jan 29, 2011 12:09 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Hema ,

That is very common error we used get while working with WD ABAP .

Here you just need to understand that this error is due to the result of not instantiation of any class.

In Web Dynpro method we generally have to work with various class and when you are using any method of that class you have to instantiate the class properly.

Now about your scenario:-

You have declared the class CONTEXT_ELEMENT of TYPE REF TO IF_WD_CONTEXT_ELEMENT but you have not instantiate it.

In your debugger if possible the you can check that at the begging any class initialize that we instantiate the class.

Now first you have to declare something like :-

DATA name of the variable TYPE REF TO IF_WD CONTEXTNODE.

DATA data CONTEXT_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT.

You have node in the context of your view controller so you hav to instantiate the variable of type IF_WD_CONTEXT_NODE.

To instantiate:-

name of the variable = WD_CONTEXT ->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_name of the context node required).

WD_CONTEXT is the referrence created to the controller context for any node you create in the context of a controller,

a constant with the name WDCTX is automatically creted.

from that name of the variable now you can instantiate CONTEXT_ELEMENT .

CONTEXT_ELEMENT = name of the variable ->GET_ELEMENT( ).

  • Get key information for selected navigation list entry

context_element->get_static_attributes(

IMPORTING

static_attributes = ls_navi_list ).

Now i think it run without any issue.

Reply in case of any issue.

Thanks and Regards,

Monishankar C

Former Member
0 Kudos

Hi ,

First you have to get the Node instance then from that you have to fetch the element instance ,the sample code for the

same is :

where N1 is node name in context

DATA lo_nd_n1 TYPE REF TO if_wd_context_node.

DATA lo_el_n1 TYPE REF TO if_wd_context_element.

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

lo_nd_n1 = wd_context->get_child_node( name = wd_this->wdctx_n1 ).

  • get element via lead selection

lo_el_n1 = lo_nd_n1->get_element( ).

Regards

Kuldeep

Former Member
0 Kudos

Problem happens as because the line

data CONTEXT_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT.

since it is just declared, object is not created.

What you can do is.Define a context_element as importing parameter type ref to if_wd_context_element.

OnSelectevent, automatically pass the reference of the select element to the importing parameter.