on 04-05-2012 1:56 AM
Hey, so i am having issues with binding nested Nodes to the context.
I.e. My context contains
NODE - form interface
L attribute - notif_no
L node - addr
L attribute - STREET
L attribute - CITY
so my main node has 1 attributes and a nested node with two attributes..
I am Finding i can either bind the sub node, or the main node..
CODE BELLOW:
* GETS MY MAIN NODE
lo_nd_form_interface = wd_context->get_child_node( name = wd_this->wdctx_form_interface ).
* get element via lead selection
lo_el_form_interface = lo_nd_form_interface->get_element( ).
* get all declared attributes
lo_el_form_interface->get_static_attributes(
IMPORTING
static_attributes = ls_form_interface ).
*GETS THE NESTED NODE
* navigate from <FORM_INTERFACE> to <ADDR> via lead selection
lo_nd_addr = lo_nd_form_interface->get_child_node( name = wd_this->wdctx_addr ).
* get element via lead selection
lo_el_addr = lo_nd_addr->get_element( ).
* get all declared attributes
lo_el_addr->get_static_attributes(
IMPORTING
static_attributes = ls_addr ).
lo_nd_form_interface = wd_context->get_child_node( wd_this->wdctx_form_interface ).
lo_nd_addr = lo_nd_form_interface->get_child_node( wd_this->wdctx_addr ).
FILL THE NODES:
ls_form_interface-notif_no = ls_params-notif_no.
SELECT SINGLE *
FROM zofr_hru_addr
INTO ls_addr
WHERE option_no = '1'
AND begda <= sy-datum
AND endda >= sy-datum.
HERE IS MY ISSUE:
lo_nd_addr->bind_structure( ls_addr ).
lo_nd_form_interface->bind_structure( ls_form_interface ).
If i just bind the addr structure i get the address info fine.
If i just bind the form_interface structure i get the form_interface info fine.
But i dont know how to bind them both, or how to bind the addr structure to the form_interface.
Any help would be great!!!
-Jason
If i understand right , your node structure is
Interface
|
__ Addr
Can you also specify the cardinality of both the nodes.
You need to keep this in mind when working with nested nodes.
"A Child node exists on a Parent Element"
To Bind data to a child node , you need to get access to your parent element.
e.g.
DATA lo_nd_interface TYPE REF TO if_wd_context_node.
DATA lo_el_interface TYPE REF TO if_wd_context_element.
DATA ls_interface TYPE wd_this->element_interface.
DATA lo_nd_addr TYPE REF TO if_wd_context_node.
DATA lo_el_addr TYPE REF TO if_wd_context_element.
DATA ls_addr TYPE wd_this->element_addr.
* navigate from <CONTEXT> to <INTERFACE> via lead selection
lo_nd_interface = wd_context->get_child_node( name = wd_this->wdctx_interface ).
* get element via lead selection
lo_el_interface = lo_nd_interface->get_element( ).
* alternative access via index
* lo_el_interface = lo_nd_interface->get_element( index = 1 ).
* get all declared attributes
lo_el_interface->Set_static_attributes(
EXPORTING
static_attributes = ls_interface ).
lo_nd_addr = lo_el_interface->GET_CHILD_NODE( NAME = 'ADDR' ). "Understand how this reference if retrieved
* alternative navigation via index
* lo_nd_addr = wd_context->path_get_node( path = `INTERFACE.1.ADDR` ).
* get element via lead selection
lo_el_addr = lo_nd_addr->get_element( ).
* set all declared attributes
lo_el_addr->set_static_attributes(
static_attributes = ls_addr ).
Regards,
Ashish Shah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Also keep an eye on Singleton property of a node. Hope this must be suitable for your requirement.
Regards,
Bharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.