cancel
Showing results for 
Search instead for 
Did you mean: 

Access via 'NULL' object reference not possible - GET_RANGE_TABLE_OF_SEL_

Former Member
0 Kudos

Hi Guru's,

i am new for WebDynpro programming.I am trying to use select-options tutorial.

System showing select options and table binding on screen when i test the application.

I have using search button to get the value which user will i/p.for that onaction method created, i have writen the code to get the values which user will input.

Method given below is of componentcontroler

method wddoinit .

data: lt_range_table type ref to data,

rt_range_table type ref to data,

read_only type abap_bool,

lt_range_table1 type ref to data.

data: lr_componentcontroller type ref to ig_componentcontroller,

l_ref_cmp_usage type ref to if_wd_component_usage.

  • create the used component

l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).

if l_ref_cmp_usage->has_active_component( ) is initial.

l_ref_cmp_usage->create_component( ).

endif.

wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).

wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).

wd_this->m_handler->set_global_options(

i_display_btn_cancel = abap_false

i_display_btn_check = abap_false

i_display_btn_reset = abap_false

i_display_btn_execute = abap_false ).

lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).

wd_this->m_handler->add_selection_field( i_id = 'CARRID'

it_result = lt_range_table i_read_only = read_only ).

call method wd_this->m_handler->add_horizontal_divider

exporting

i_id = 'LINE'.

endmethod.

Method given below is of VIEW.

method ONACTIONSEARCH .

DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: RT_CARRID TYPE REF TO DATA.

DATA: ISFLIGHT TYPE TABLE OF SFLIGHT.

DATA: WSFLIGHT TYPE SFLIGHT.

FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE.

  • Retrieve the data from the select option

RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).

  • Assign it to a field symbol

ASSIGN RT_CARRID->* TO <FS_CARRID>.

CLEAR ISFLIGHT. REFRESH ISFLIGHT.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ISFLIGHT FROM SFLIGHT

WHERE CARRID IN <FS_CARRID>.

NODE_FLIGHTS = WD_CONTEXT->GET_CHILD_NODE( NAME = `FLIGHTS` ).

NODE_FLIGHTS->BIND_ELEMENTS( ISFLIGHT ).

endmethod.

while executing appln. error is trigger on line given below

RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).

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

please help me out on this issue.

Thanks and Regards

Vinayak Sapkal

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi ,

The attribute M_HANDLER is an attirbute of component controller (as told by your post) and so you cannot access it as you have done it.

You will have to access it as .

WD_COMP_CONTROLLER->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD(I_ID = 'S_CARR_ID' ).

Try doing it.

Or else , if you have created a similar attribute in your view itself , then it is "INITIAL" and hence you are getting the dump.

You will have to assign the view attribute "M_HANDLER" with the value of your component controller attribute "M_HANDLER" ,because all the initializations are done in WDDOINIT of comp controller and on component controller atribute "M_HANDLER".

Thanks,

aditya.

Former Member
0 Kudos

Hi Aditya,

i have created m_handler in component controller and main view (ref to IF_WD_SELECT_OPTIONS).

I tried with WD_COMP_CONTROLLER->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD(I_ID = 'S_CARR_ID' ).

in onactionsearch but it throws error while checking 'field M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( neither in one of specified table nor defined by Data'

Thanks and Regards

Vinayak Sapkal

Former Member
0 Kudos

HI ,

Make sure that the attribute is public.

You can also also assign the view attribute (M_HANDLER) with the value of component controller attribute(M_HANDLER) in the handler of button before using it.

The problem is that the view attribute is initial .

So to overcome , you have to either use the component controller attribute or assign the component controller attribute value to view attribute and use it.

Hope I am clear.

Thnks,

aditya.

Madhu2004
Active Contributor
0 Kudos

HI,

Donot create M_HANDLER both in component controller and main view. Create M_HANDLER only in component controller.

When you are using M_HANDLER in component controller emthods use WD_THIS->M_HANDLER.

When You are using M_HANDLER in methods other than component controller user WD_COMP_CONTOLLER->M_HANDLER.

Regards,

madhu

Former Member
0 Kudos

Hi Guru's,

i tried with 'WD_COMP_CONTROLLER->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD(I_ID = 'S_CARR_ID' )'

its perfectly fine.

it is not showing any error while checking and activating but when i click on search button it throws DUMP.

'The current application triggered a termination with a short dump.'

The current application program detected a situation which really

should not occur. Therefore, a termination with a short dump was

triggered on purpose by the key word MESSAGE (type X).

Thanks and Regards

Vinayak Sapkal

Former Member
0 Kudos

Hi Guru's,

i tried with 'WD_COMP_CONTROLLER->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD(I_ID = 'S_CARR_ID' )'

its perfectly fine.

it is not showing any error while checking and activating but when i click on search button it throws DUMP.

i put break point on onactionsearch method but it is not reach up to that method and throws dump.

'The current application triggered a termination with a short dump.'

The current application program detected a situation which really

should not occur. Therefore, a termination with a short dump was

triggered on purpose by the key word MESSAGE (type X).

Thanks and Regards

Vinayak Sapkal

Madhu2004
Active Contributor
0 Kudos

HI,

Please check the dump details in ST22.Check source code extract and active calls and analyze the reson fro the dump.

Else post the source code extract to analyze the dump further.

Regards,

madhu