Skip to Content

invalidate( ) doesn't invalidate child nodes

Hello everyone,

I've created context nodes dynamically through:

            new_node = node_info->add_new_child_node( name = nodename
                                           is_singleton = abap_false
                                           is_multiple = abap_false
                                           is_mandatory = abap_true
                                           is_initialize_lead_selection = abap_true
                                           is_static = abap_false ).

I've then invalidated the parent node through:

   lo_nd_contract = wd_context->path_get_node( path = `CONTRACT` ).
  lo_nd_contract->invalidate( ).
  lo_nd_contract = wd_context->path_get_node( path = `CONTRACT.COMPANY_CONTACTS.COMPANY_CONTACT_1` ).
  lo_el_contract  = lo_nd_contract->get_element( ).
      lo_el_contract->get_attribute(
                EXPORTING
                  name =  `COMPANY_CONTACT_1`
                IMPORTING
                  value = lv_company_contact_0 ).

but the variable lv_company_contact_0 still retains the old value.

Any ideas as to what's going on?

Thank you!

Edited by: Development Themis on May 3, 2011 6:25 PM

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo
    Former Member
    Posted on May 03, 2011 at 07:24 PM

    Hi,

    does any of these nodes CONTRACT.COMPANY_CONTACTS.COMPANY_CONTACT_1 have supply function ?

    This method invalidates all elements of the node. This means that all elements and subnode

    instances are deleted. Afterwards the status of the node is as it is in its initial state. When an

    element or an attribute is requested again, the supply method is called, if it is available.

    Add comment
    10|10000 characters needed characters exceeded

    • I've fixed the problem.

      > The thing is that I created the node as

       is_mandatory = abap_true 

      and the node was not deleted (actually it disappeared from the context in the Debug but appeared back in whenever I tried to access it).

      If you understand the purpose of these properties while creating dynamic nodes , you will not run into issues again.

      IS_MENDATORY --> Used to specify lower canrdinality

      IS_MULTIPLE --> used to specify higher cardinality

      So by specifying is_mandatory = abap_true , you had set lower cardinality to 1 and that caused the problem.

      Regards,

      Ashish Shah