cancel
Showing results for 
Search instead for 
Did you mean: 

Access via 'NULL' object reference not possible

Former Member
0 Kudos

Hello WD Experts,

I am receiving this message.

Access via 'NULL' object reference not possible
The ABAP call stack was: 
Method: WDDOMODIFYVIEW of program /1BCWDY/5NRD5TKGE1K9JUDKWN52==CP

I have no presumption or idea how this error could result.

Maybe someone had already something similar and can give me crucial hint.

I know just where the program dumps within the Coding:

CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name into l_binding_string.

component controller's public Attribute defined as :

VALUE_HELP_LISTENER type ref to IF_WD_VALUE_HELP_LISTENER

Friendly Regards

ilhan Ertas

Edited by: Ilhan Ertas on May 17, 2009 8:39 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I dont have any attribute I have only a node ?

Further More I only took coding of Thomas Jung

Former Member
0 Kudos

Guess you added the interface IWD_VALUE_HELP to your component ?

Radhika.

Former Member
0 Kudos

Dear Radhika,

as mentioned I have originally copied all the code from Thomas Jung.

He was adviced me to do it as follows.

To your question: Yes I did otherwise where else should I heve this method.

It was implemented automatically by the runtime envoronment

You can also try to implement the below example

you will have also a dump

MET set_value_help_listener .
 
  wd_this->value_help_listener = listener.
 
****Check the data type of the source field - it must be a date data type.

  IF wd_this->value_help_listener->f4_attribute_info-rtti->type_kind NE cl_abap_typedescr=>typekind_numeric.
  ENDIF.
 
  DATA lo_nd_calculator TYPE REF TO if_wd_context_node.
  DATA lo_el_calculator TYPE REF TO if_wd_context_element.

  data dyn_node_info type ref to if_wd_context_node_info.


  lo_nd_calculator = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
  dyn_node_info = lo_nd_calculator->get_node_info( ).
  dyn_node_info->add_attribute( wd_this->value_help_listener->f4_attribute_info ).
 
ENDMET.

met DOMODI .

  data lo_tc type ref to cl_wd_transparent_container.
  data lo_inputfield type ref to cl_wd_input_field.

  if first_time = abap_true.
    lo_tc ?= view->get_element( 'TC_INPUTFIELD' ).

    data l_binding_string type string.

    CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name
      into l_binding_string.

    lo_inputfield = cl_wd_input_field=>new_input_field(
         bind_value             = l_binding_string
         enabled                = abap_true
         id                     = 'VH_INPUT'
*        length                 = '20'
         read_only              = abap_true
         view                   = view
*        visible                = E_VISIBLE-VISIBLE
*        width                  = width
    ).
    data flow type ref to CL_WD_FLOW_DATA.
    flow = CL_WD_FLOW_DATA=>new_flow_data(
*        cell_design = E_CELL_DESIGN-PADLESS    " CELL_DESIGN
        element     = lo_inputfield
        id          = 'FLOW_ID'
*        v_gutter    = E_V_GUTTER-NONE    " V_GUTTER
    ).
 
    lo_inputfield->set_layout_data( flow ).
 
    lo_tc->add_child( lo_inputfield ).
  endif.
 
endmet.

Answers (7)

Answers (7)

Former Member
0 Kudos

yes but why is it intial. What has to be made in this case ????

Former Member
0 Kudos

Either your attribute is not set or you can check if by any chance your attribute value_help_listener is getting cleared at any point ?

Regards,

Radhika.

Former Member
0 Kudos

I dont understand your question correctly .......

Yes I did check it while debugging and as already mentioned it is initial. What else must be checked

with WD_COMP_CONTROLLER->value_help_listener

At the very first WDDOMODIFYVIEW is called and above mentioned line the program dumps

with the error message Access via 'NULL' object reference not possible

Did I maybe forget to insert an element under the node in the Component Controller ????

Cause I only have a node single there without any element

Former Member
0 Kudos

There you go.. So this is your problem.

Your attribute with WD_COMP_CONTROLLER->value_help_listener is initial and you try to acces

f4_attribute_info-name as follows :

CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name

Hence the dump.

check if you are initializing the attribute value_help_listener i.e. are you passing any value to this attribute ?

Edited by: Radhika Vadher on May 18, 2009 3:07 PM

Former Member
0 Kudos

this line causes this error

CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name

WD_COMP_CONTROLLER->value_help_listener is in the debugger initial

This is strange. What has to be done to avoid this case

Former Member
0 Kudos

Hi ,

As i said above, WD_COMP_CONTROLLER->value_help_listener may be initial.

Did you check the value of WD_COMP_CONTROLLER->value_help_listener while debugging ?

Former Member
0 Kudos

what do you mean with

setting WD_COMP_CONTROLLER->value_help_listener with the required value.

This the code:

method SET_VALUE_HELP_LISTENER .
wd_this->value_help_listener = listener.

****Check the data type of the source field - it must be a date data type.
  IF wd_this->value_help_listener->f4_attribute_info-rtti->type_kind NE cl_abap_typedescr=>typekind_numeric.
  ENDIF.

  DATA lo_nd_calculator TYPE REF TO if_wd_context_node.
  DATA lo_el_calculator TYPE REF TO if_wd_context_element.
  data dyn_node_info type ref to if_wd_context_node_info.
* navigate from <CONTEXT> to <CALCULATOR> via lead selection
  lo_nd_calculator = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
  dyn_node_info = lo_nd_calculator->get_node_info( ).
  dyn_node_info->add_attribute( wd_this->value_help_listener->f4_attribute_info ).


endmethod.

Former Member
0 Kudos

of course I can.

method WDDOMODIFYVIEW .
  data lo_tc type ref to cl_wd_transparent_container.
  data lo_inputfield type ref to cl_wd_input_field.
  if first_time = abap_true.
    lo_tc ?= view->get_element( 'TC_INPUTFIELD' ).
    data l_binding_string type string.
    CONCATENATE `CALCULATOR.` 
WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name
      into l_binding_string.
    lo_inputfield = cl_wd_input_field=>new_input_field(
         bind_value             = l_binding_string
         enabled                = abap_true
         id                     = 'VH_INPUT'
         read_only              = abap_true
         view                   = view
    ).
    data flow type ref to CL_WD_FLOW_DATA.
    flow = CL_WD_FLOW_DATA=>new_flow_data(
        element     = lo_inputfield
        id          = 'FLOW_ID'
    ).

    lo_inputfield->set_layout_data( flow ).

    lo_tc->add_child( lo_inputfield ).
  endif.
endmethod.

Furthermore in view's context is also one node named CALCULATOR with no Attribut to its

below. With the other words 'Component Controller' has one node as Calculator

and the view has one node as Calculator too.

For more information refer to my posting regarding this topic.

The Code was given to me by SAP SuperMentor -> Thomas Jung

Former Member
0 Kudos

I hope you are setting WD_COMP_CONTROLLER->value_help_listener with the required value.

Check if it is not null during runtime.

Regards,

Radhika.

Former Member
0 Kudos

Dear Abhi

this value is set in the below shown. Method SET_VALUE_HELP_LISTENER is implemented

within Component Controller. What else can be the reason ?

I also have a node within Component Controller Context and View's context with the name

CALCULATOR. But there is no element under the this node. Is it necessary ?

Regards

ilhan

method SET_VALUE_HELP_LISTENER .
wd_this->value_help_listener = listener.


  IF wd_this->value_help_listener->f4_attribute_info-rtti->type_kind NE   cl_abap_typedescr=>typekind_numeric.
  ENDIF.

  DATA lo_nd_calculator TYPE REF TO if_wd_context_node.
  DATA lo_el_calculator TYPE REF TO if_wd_context_element.
  data dyn_node_info type ref to if_wd_context_node_info.


  lo_nd_calculator = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
  dyn_node_info = lo_nd_calculator->get_node_info( ).
  dyn_node_info->add_attribute( wd_this->value_help_listener->f4_attribute_info ).
endmethod.

Edited by: Ilhan Ertas on May 17, 2009 7:54 PM

Former Member
0 Kudos

Hi,

Generally,this type of error occurs when we try to access some attribute whose value has not been set till that point. So just point a break point in your code and check whether all the attributes are being set before they are being used.

thnks

abhimanyu_lagishetti7
Active Contributor
0 Kudos

can you post the code in WDDOMODIFYVIEW, if you are showing a form in the layout then element in the node CALCULATOR is mandatory.

Abhi

abhimanyu_lagishetti7
Active Contributor
0 Kudos

where you are setting VALUE_HELP_LISTENER, this field needs to be filled with an instance in the method SET_VALUE_HELP_LISTENER of the componentcontroller.

in WDDOMODIFYVIEW simply you are using the VALUE_HELP_LISTENER without any instance.

Abhi