Reference Path to Deeper Context Nodes

If you require access to a node that is a few levels below the root node in the context tree structure, there are two possibilities. The graphic below depicts the structure situation of the context again. The context node to process with the program is SubNode_21.

1st Variant

You can repeat the process outlined inDirect Reference to a Context Node step by step until you 'reach' the required node.

method EXAMPLE .

data: l_node                     type ref to IF_WD_CONTEXT_NODE,

l_snode_11    type ref to IF_WD_CONTEXT_NODE,

L_snode_21    type ref to IF_WD_CONTEXT_NODE.

l_node     = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_snode_11 = l_node->get_child_node( wd_this->wdctx_subnode_11 ).

l_snode_21 = l_snode_11->get_child_node( wd_this->wdctx_subnode_21 ).

. . . . . . . . .

endmethod.

2nd Variant

You can use the PATH_GET_NODE method to reference the required subnode.

method EXAMPLE .

data:    l_snode_21    type ref to IF_WD_CONTEXT_NODE.

l_snode_21 = wd_context->path_get_node( 'NODE_1.SUBNODE_11.SUBNODE_21' ).

. . . . . . . . .

endmethod.

This formulation can be varied depending on which context node  is already known in the method at the time of the call of PATH_GET_NODE.

method EXAMPLE .

data: l_node                     type ref to IF_WD_CONTEXT_NODE,

l_snode_21    type ref to IF_WD_CONTEXT_NODE.

. . . . . . . . .

l_snode_21 = l_node->path_get_node( 'SUBNODE_11.SUBNODE_21' ).

. . . . . . . . .

endmethod.

lo_node = wd_context->path_get_node(
    wd_this->wdctx_node1 && '.' && wd_this->wdctx_node2 ).