cancel
Showing results for 
Search instead for 
Did you mean: 

Access via 'NULL' object reference not possible. in Dynamic tree generation

Former Member
0 Kudos

Dear friends,

I am creating tree like given in WDR_TEST_EVENTS >> TREE_STATIC_DYNLOAD View.

I am doing it beacause I want create tree for showing HR org units like T code

pposa .

But when I clicking on node that in created at second level as

Access via 'NULL' object reference not possible. It is on_load_children () method.

I know normally when this error come .

Dump

The following error text was processed in the system : Access via 'NULL' object reference not possible.

The error occurred on the application serverand in the work process 1 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: GET_ACTION_FROM_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP

Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP

Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME

Module: %_HTTP_START of program SAPMHTTP

Cheers ,

Parry

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Parry.

Pls paste the code of the on_load_children method.

Cheers,

Sascha

Former Member
0 Kudos

method ONACTIONON_LOAD_CHILDERN .

DATA:

new_node_name TYPE string,

guid TYPE guid_32,

lr_context_node TYPE REF TO if_wd_context_node,

lr_new_context_node TYPE REF TO if_wd_context_node,

lr_node_info TYPE REF TO if_wd_context_node_info,

lt_attributes TYPE wdr_context_attr_info_map,

attribute LIKE LINE OF lt_attributes,

lt_context_nodes TYPE wdr_context_child_map,

data_source_path TYPE string,

text_path TYPE string,

expanded_path TYPE string,

objid_path TYPE string,

lr_tree_node_type TYPE REF TO cl_wd_tree_node_type.

  • check, if the context node has already a child node

lt_context_nodes = Context_element->get_child_nodes( ).

IF lt_context_nodes[] IS INITIAL.

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_32 = guid.

new_node_name = guid.

TRANSLATE new_node_name TO UPPER CASE. "#EC SYNTCHAR

CONCATENATE 'G' new_node_name INTO new_node_name. "guids might start with a number

attribute-name = 'STEXT'.

attribute-type_name = 'STRING'.

INSERT attribute INTO TABLE lt_attributes.

attribute-name = 'OBJID'.

attribute-type_name = 'STRING'.

INSERT attribute INTO TABLE lt_attributes.

attribute-name = 'EXPANDED'.

attribute-type_name = 'WDY_BOOLEAN'.

INSERT attribute INTO TABLE lt_attributes.

lr_context_node = context_element->get_node( ).

lr_node_info = lr_context_node->get_node_info( ).

                                          • Read Current Counter ****************************************

DATA:

elem_context TYPE REF TO if_wd_context_element,

stru_context TYPE wd_this->element_context ,

item_counter LIKE stru_context-item_counter.

  • get element via lead selection

elem_context = wd_context->get_element( ).

  • get single attribute

elem_context->get_attribute(

EXPORTING name = `ITEM_COUNTER`

IMPORTING value = item_counter ).

lr_node_info->add_new_child_node(

supply_method = 'FILL_DEPT_UNIT'

supply_object = me

name = new_node_name

is_mandatory = abap_false

is_mandatory_selection = abap_false

is_multiple = abap_true

is_multiple_selection = abap_true

is_singleton = abap_false

is_initialize_lead_selection = abap_false

is_static = abap_false

attributes = lt_attributes ).

lr_new_context_node = context_element->get_child_node( new_node_name ).

data_source_path = lr_new_context_node->get_meta_path( withoutcontroller = abap_true ).

CONCATENATE data_source_path '.STEXT' INTO text_path.

CONCATENATE data_source_path '.EXPANDED' INTO expanded_path.

lr_tree_node_type = cl_wd_tree_node_type=>new_tree_node_type(

bind_data_source = data_source_path

bind_text = text_path

bind_expanded = expanded_path

on_load_children = 'ON_LOAD_CHILDREN'

view = wd_this->m_tree->view ).

wd_this->m_tree->add_node_type( lr_tree_node_type ).

ENDIF.

***********************************************************************************************

And Supply

METHOD FILL_DEPT_UNIT .

Types: Begin of Str_sobid,

sobid type hrp1001-sobid,

end of Str_sobid.

DATA:

itab_org_unit TYPE wd_this->elements_org_unit ,

itab_nd_sobid TYPE Standard table of Str_sobid,

stru_nd_sobid like line of itab_nd_sobid,

wa_nd_sobid LIKE LINE OF itab_nd_sobid ,

lv_org_objid TYPE hrobjid ,

lv_stext TYPE stext.

parent_element->get_attribute( EXPORTING name = 'STEXT' IMPORTING value = lv_stext ).

SELECT objid FROM hrp1000 INTO lv_org_objid

WHERE stext = lv_stext .

ENDSELECT.

SELECT sobid

FROM hrp1001

INTO CORRESPONDING FIELDS OF TABLE itab_nd_sobid

WHERE plvar = '01'

AND rsign = 'B'

AND relat = '002'

AND sclas = 'O'

AND objid = lv_org_objid

AND otype = 'O'.

LOOP AT itab_nd_sobid INTO wa_nd_sobid .

SELECT stext objid

APPENDING CORRESPONDING FIELDS OF TABLE itab_org_unit

FROM hrp1000 WHERE objid = wa_nd_sobid-sobid AND otype = 'O'.

ENDLOOP.

IF itab_org_unit IS NOT INITIAL.

node->bind_table(

new_items = itab_org_unit

set_initial_elements = abap_true ).

ENDIF.

ENDMETHOD.

Former Member
0 Kudos

hmmm no idea so far ..

could you also post the source code extract of the short dump?

maybe this helps ...

Cheers,

Sascha

Former Member
0 Kudos

Dear sascha , Thanks a lot .

This is source code extract ...

That highlighted line is pointed by St22

method get_action_from_event.

data: id type string,

view_name type string,

controller_manager type ref to cl_wdr_component,

client_component type ref to cl_wdr_client_component,

target type ref to cl_wdr_controller.

check root_component->is_deleted = abap_false.

split event->view_name at `.` into id view_name.

client_component = cl_wdr_client_application=>get_instance( id ).

controller_manager = client_component->component.

target = controller_manager->get_controller( view_name ).

action ?= target->get_action_internal( event->command ).

if event->type = event->co_action_event.

>>>>>>>>> <i> action->set_parameters( event->parameters ).</i>

action->set( ui_event = event->ui_element_event ).

else.

action->set_parameters( event->parameters ).

endif.

endmethod.

Former Member
0 Kudos

Did you define the onAction event in the TreeNodeType UI Element like in the example? Seems that it does not find an action. Maybe thsi helps. But I am not sure. Just a guess.

Cheers,

Sascha

Former Member
0 Kudos

Yes I have written code .

I am retriving data from database based on value of tree node selected .But when I am clicking node it is not having any problem .It shows dump when I try to exapnd it .