on 09-18-2008 1:06 PM
Hi,
I'm trying to wrting to the nested node in the context but I can't.
I have the following context:
root
-
pai (1..n) singleton
-
filho(1..n) singleton
I'm tryng to do a master/detail application.
The node pai is bound to a table in my view, the node filho is bound to another. My objective is to show the detail (node filho) correct to each line in table master.
I can write to node pai, it works. I wrote to the node filho too, but when I debug, only one element of node child is filled.
If someone could help me, I would be thankfull.
The complete code is here, I put it into the wd_doinit of my view:
data: table_pai type wd_this->elements_pai,
table_pai_linha type wd_this->element_pai,
passo type matnr,
lo_nd_pai type ref to if_wd_context_node,
lo_nd_filho type ref to if_wd_context_node,
lo_el_filho type ref to if_wd_context_element,
table_filho_linha type wd_this->element_filho,
lo_el_pai type ref to if_wd_context_element,
cont type integer.
passo = '123456789012345678'.
do.
table_pai_linha-matnr = passo.
append table_pai_linha to table_pai.
passo = passo + 1.
if passo = '123456789012345683'.
exit.
endif.
enddo.
lo_nd_pai = wd_context->get_child_node( 'PAI ').
lo_nd_pai->bind_table( new_items = table_pai set_initial_elements = abap_false ).
cont = lo_nd_pai->get_element_count( ).
do.
lo_nd_pai->SET_LEAD_SELECTION_index( cont ).
lo_el_pai = lo_nd_pai->get_element( ).
lo_nd_filho = lo_el_pai->get_child_node( wd_this->wdctx_filho ).
lo_el_filho = lo_nd_filho->create_element( ).
lo_nd_pai->get_attribute( exporting name = 'matnr' importing value = passo ).
table_filho_linha-matnr_filho = passo.
lo_el_filho->set_static_attributes(
exporting
static_attributes = table_filho_linha ).
lo_nd_filho->bind_element( new_item = lo_el_filho set_initial_elements = abap_false ).
cont = cont - 1.
if cont = 0.
exit.
endif.
enddo.
thanks,
remove the singleton property of your node
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check the document
http://help.sap.com/saphelp_erp2005/helpdata/en/7a/787e40417c6d1de10000000a1550b0/content.htm
Yogesh N
Yogesh,
I read the article.
So, If I set the node "filho" as singleton I can't fill this node with elements for all elements of node "pai".
The elements will be lost. It is that I don't understand, if the elements will be lost, there are no reason to use singleton, I can't imagine when I could use this option.
If I want to fill all the context in one time, I have to set the node as non-singleton.
Is all that I said correct?
sorry for the quantity of questions, but I'm new in WD4Abap and I want to learn very much.
Thanks a lot
If I want to fill all the context in one time, I have to set the node as non-singleton.
Is all that I said correct?
Yes, if you have to fill all context then you dont use singleton property. but sometime we have to read node which contains large amount of data, in this case we can use singleton property to limit the data.
Yogesh N
User | Count |
---|---|
85 | |
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.