on 09-06-2010 8:36 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adrian,
Can you post the error log you get?
Best regards,
Chinnu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.