on 09-11-2011 9:16 PM
Hi All,
I am trying to display message if I select carrid from dropdown Say AA ,relevant records get displayed but if I select AB or some other airline name and that does not have any records or that airline doesnot exist message get displayed (any message say records not found)
For the message code(in bold) i am getting Access via 'NULL' object reference not possible.
Here is my code:
DATA lo_nd_airline_id TYPE REF TO if_wd_context_node.
DATA lo_el_airline_id TYPE REF TO if_wd_context_element.
DATA lo_nd_airline_info TYPE REF TO if_wd_context_node.
DATA lo_el_airline_info TYPE REF TO if_wd_context_element.
DATA lt_airline_id TYPE wd_this->elements_airline_id.
DATA ls_airline_id TYPE wd_this->element_airline_id.
DATA lt_airline_info TYPE wd_this->elements_airline_info.
DATA ls_airline_info TYPE wd_this->element_airline_info.
navigate from <CONTEXT> to <AIRLINE_INFO> via lead selection
lo_nd_airline_id = wd_context->get_child_node( name = wd_this->wdctx_airline_id ).
navigate from <CONTEXT> to <AIRLINE_INFO> via lead selection
lo_nd_airline_info = wd_context->get_child_node( name = wd_this->wdctx_airline_info ).
lo_nd_airline_id->get_static_attributes_table( IMPORTING table = lt_airline_id ).
lo_nd_airline_info->get_static_attributes_table( importing table = lt_airline_info ).
READ TABLE lt_airline_id INTO ls_airline_id INDEX index.
SELECT carrid connid fldate FROM sflight INTO CORRESPONDING FIELDS OF TABLE lt_airline_info WHERE carrid = ls_airline_id-carrid.
lo_nd_airline_info->bind_table( lt_airline_info ).
IF ls_airline_id-carrid NE ls_airline_info-carrid .
get message manager*
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager
.
report message*
CALL METHOD lo_message_manager->report_attribute_message
EXPORTING
message_text = 'No records found'
message_type = CO_TYPE_ERROR*
element = lo_el_airline_id
attribute_name = 'CARRID'
.
ENDIF.
Thanks,
Kiran
In your coding , i am not seeing that lo_el_airline_id is any where initialized. Probably this is why you get error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI kiran,
It means some variable has null value( no value ).you can check in ST22 and go through that page, you will find arrow mark like >>>>>> before the error line code.
And as per your code i observed, what value you are passing in Index variable in Read table statement. May be there you are gettting error.
your way of retrieving is quite confusing, okay you just rethink once again.about index value. check in debugging
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran,
Goto ST22 and check where you are getting error.
Null objcts means some element might be initial.. find that and chagne your code.
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.