Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Master Detail - Help me


I'm trying to wrting to the nested node in the context but I can't.

I have the following context:



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'.

    table_pai_linha-matnr = passo.

    append table_pai_linha to table_pai.

    passo = passo + 1.

    if passo = '123456789012345683'.


  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(  ).


    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.
      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.



Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question