Skip to Content
author's profile photo Former Member
Former Member

bind_element raising exception node already bound

Hi,

ive got 3 context nodes with the same attributes.

based on the action on on node.. i want to copy the elements to one of the other two nodes

i am doing a loop after get_elements

doing my tests and after that i want to bind_element with lo_element on one of the two context nodes already bound

but than it raises the exception ..

  lo_vbeln_break_fail_node    = lo_parent_node->get_child_node( 'VBELN_BREAK_SUCCESS' ).
  lo_vbeln_break_success_node = lo_parent_node->get_child_node( 'VBELN_BREAK_FAIL' ).


  lo_selected_vbeln_node = lo_parent_node->get_child_node( 'SELECTED_VBELN' ).
  it_child_elements = lo_selected_vbeln_node->get_elements( ).

  LOOP AT it_child_elements INTO lo_child_element.

    TRY .
.....
     
CATCH cx_root INTO lo_cx_root.

        lo_vbeln_break_fail_node->bind_element( EXPORTING new_item = lo_child_element
                                                          set_initial_elements = abap_true ).

        CONTINUE.
    ENDTRY. 

    lo_vbeln_break_success_node->bind_element( EXPORTING new_item = lo_child_element
                                                         set_initial_elements = abap_true ).
  ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Sep 06, 2010 at 08:11 AM

    HI,

    You are binding the elemnt of the main node to other nodes, this will raise exception as the element will have reference to the main node.

    In the loop get the attributes from the main node and based on the condition create element for the other nodes and set the attributes

    to the new element and bind this element.

    Element can be created using the create_element method os if_wd_context_node.

    Regards,

    Madhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2010 at 08:14 AM

    hmm ok,

    thought i could easily bind the already perfect element to some other context since i dont have to change anything in the element.

    well .. its just a get_static_attributes and bind_structure

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2010 at 08:17 AM

    hi,

    based on the condition, u can use the set_attribute method to set the attribute of the particular context node to a value.

    regards,

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2010 at 08:59 AM

    Hi Adrian,

    Can you post the error log you get?

    Best regards,

    Chinnu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Well.

      if did it with set_static_attributes now.

      error log was something like node already bound while trying to bind_element().

      "UNCAUGHT_EXCEPTION" "CX_WD_CONTEXT"

      "CL_WDR_CONTEXT_NODE_VAL=======CP" bzw.

      "CL_WDR_CONTEXT_NODE_VAL=======CM005"

      "INSERT_ELEMENT_ELEMENT_REF"

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2010 at 09:46 AM

    Hi Adrian,

    You have tried this...

    bind_element( EXPORTING new_item = lo_child_element

    set_initial_elements = abap_true ).

    new_item of type DATA is a generic definition and hence does not return any compile time error. In general new_item referes to a internal table.

    if you want to set the element, try bind_element( EXPORTING element = <parent_element> set_initial_elements = abap_true ).

    Best regards,

    Chinnu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.