on 01-15-2009 12:38 PM
Hi!
I have 2 views and I navigate forth and back. On the second view I am creating a context node dynamically in method HANDLEFROM_INPUT_VIEW. Everything works fine for the first time. However, if I go back from the second view to the first one and then again navigate to the second view, the system attempts to create the new node with the same name like the existing one and I get a short dump (an exception cx_wd_context=>child_already_exist).
I tried to delete the existing node by using the below code, which I placed in methods WDDOINIT, HANDLEFROM_INPUT_VIEW (before creating the node), ONACTIONBACK and WDDOINIT, but it didn't help. What can I do?
DATA: lr_info TYPE REF TO if_wd_context_node_info.
* delete existing node (if there is one)
TRY.
lr_info = wd_context->get_node_info( ).
lr_info = lr_info->get_child_node( 'DB_TABLE' ).
lr_info = lr_info->get_parent( ).
lr_info->remove_child_node( 'DB_TABLE' ).
CATCH cx_root.
ENDTRY.
Thanks in advance!
KR,
Igor
Hi,
Please try this way.
Before using the REMOVE_CHILD_NODE try to use the INVALIDATE method of the if_wd_context_node for removing the reference to the child node then go for deleting the child node.
Also, check for the child node is initial or not. Then invalidate it then delete the node.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Lekha,
I tried with no success. I debugged it and saw a strange result. Here is the new code:
TRY.
lr_node = me->wd_context->get_child_node( 'DB_TABLE' ).
lr_node->invalidate( ).
lr_info = me->wd_context->get_node_info( ).
lr_info = lr_info->get_child_node( 'DB_TABLE' ). "test to see is there such node
lr_info = lr_info->get_parent( ).
lr_info->remove_child_node( 'DB_TABLE' ).
CATCH cx_root INTO lr_error.
l_error_text = lr_error->get_text( ).
ENDTRY.
lr_info object seems consistent in debugger, lr_info->get_child_node( 'DB_TABLE' ). returns a valid object, but later the statement lr_info->remove_child_node( 'DB_TABLE' ). fires exception which says: Static Node ZTEST_COMPONENT#OUTPUT_VIEW.CONTEXT Cannot Be Deleted. But I am trying to remove 'DB_TABLE'. Why am I getting message as if I was trying to delete the entire context?
KR,
Igor
I forgot to pass parameter IS_STATIC when I was creating it in the first place:
lr_info->add_new_child_node(
EXPORTING static_element_type = l_tabname
name = 'DB_TABLE'
is_static = abap_false ).
Thanks for effort!
KR,
Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
9 | |
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.