on 07-08-2009 9:17 AM
Hi Experts,
I want to read node below at the node. This is work a sample but I have got a problem.
That is my context struck.
http://img12.imageshack.us/i/78814932.jpg/
I fill below node with supply function.
When I want to read below node, I see this error "Access via 'NULL' object references not possible".
I use code wizard for read below node.
DATA lo_nd_master TYPE REF TO if_wd_context_node.
DATA lo_el_master TYPE REF TO if_wd_context_element.
DATA lt_master TYPE wd_this->elements_master.
DATA ls_master TYPE wd_this->element_master.
DATA ls_martial TYPE wd_this->element_martial.
DATA lv_martial LIKE ls_martial-medeni.
lo_nd_master = wd_context->get_child_node( name = wd_this->wdctx_master ).
IF lo_nd_master IS INITIAL.
ENDIF.
lo_el_master = lo_nd_master->get_element( ).
IF lo_el_master IS INITIAL.
ENDIF.
lo_nd_master->get_static_attributes_table(
IMPORTING
table = lt_master ).
DATA lo_nd_martial TYPE REF TO if_wd_context_node.
DATA lo_el_martial TYPE REF TO if_wd_context_element.
lo_nd_master = wd_context->get_child_node( name = wd_this->wdctx_master ).
IF lo_nd_master IS INITIAL.
ENDIF.
lo_nd_martial = lo_nd_master->get_child_node( name = wd_this->wdctx_martial ).
IF lo_nd_martial IS INITIAL.
ENDIF.
lo_el_martial = lo_nd_martial->get_element( ).
IF lo_el_martial IS INITIAL.
ENDIF.
lo_el_martial->get_attribute(
EXPORTING
name = `MARTIAL`
IMPORTING
value = lv_martial ).
In this line is going lo_nd_martial empty.
lo_nd_martial = lo_nd_master->get_child_node( name = wd_this->wdctx_martial ).
And then I read get_attribute compared with the error.
How do I fill lo_nd_martial?
Thanks in advance.
Izzeddin YILMAZ
Thank you so much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I assume that marital node is below the master node right. what is the cardinality for the both the nodes.
If the cardinality of marital is 1:N or 0:N then you need to speicify the element index to get the get_elemnet mehtod.
DATA lo_nd_master TYPE REF TO if_wd_context_node.
DATA lo_el_master TYPE REF TO if_wd_context_element.
DATA lt_master TYPE wd_this->elements_master.
DATA ls_master TYPE wd_this->element_master.
DATA ls_martial TYPE wd_this->element_martial.
DATA lv_martial LIKE ls_martial-medeni.
lo_nd_master = wd_context->get_child_node( name = wd_this->wdctx_master ).
IF lo_nd_master IS not INITIAL.
lo_el_master = lo_nd_master->get_element( ). "speicfy index if carinality is 1:N or 0:N
lo_nd_master->get_static_attributes_table(
IMPORTING
table = lt_master ).
ENDIF.
IF lo_el_master IS not INITIAL.
ENDIF.
DATA lo_nd_martial TYPE REF TO if_wd_context_node.
DATA lo_el_martial TYPE REF TO if_wd_context_element.
lo_nd_master = wd_context->get_child_node( name = wd_this->wdctx_master ).
IF lo_nd_master IS not INITIAL. "change
lo_nd_martial = lo_nd_master->get_child_node( name = wd_this->wdctx_martial ).
ENDIF.
IF lo_nd_martial IS not INITIAL.
lo_el_martial = lo_nd_martial->get_element( ). "speicfy index if carinality is 1:N or 0:N
ENDIF.
IF lo_el_martial IS not INITIAL.
lo_el_martial->get_attribute(
EXPORTING
name = `MARTIAL`
IMPORTING
value = lv_martial ).
ENDIF.
Refer this link -
In both the nodes there should be some common field so that you can read the 2nd node element.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.