If you wish to access the View Controller from methods on the Component Controller of a Web Dynpro component, you can do this very easily following the steps below:
Suppose we have a view called V_MAIN and a context node on that view called NODE_1.
1) Create a global attribute GO_V_MAIN_CTRL of type IF_WD_VIEW_CONTROLLER in Component Controller’s attributes tab;
2) Get the reference of View Controller in WDDOINIT method of view V_MAIN as below:
wd_comp_controller->go_v_main_ctrl ?= wd_this->wd_get_api( ).
Now, you can access the View Controller in any Component Controller method. As an example, you can access the View Context Node as below:
DATA lo_context TYPE REF TO if_wd_context.
DATA lo_root_node TYPE REF TO if_wd_context_node.
DATA lo_child_node TYPE REF TO if_wd_context_node.
lo_context = wd_this->go_v_main_ctrl->get_context( ).
” get root node
lo_root_node = lo_context->root_node.
” get child node
lo_child_node = lo_root_node->get_child_node( name = ‘NODE_1’ ).
You can read more about other methods accessible by the IF_WD_VIEW_CONTROLLER here: IF_WD_VIEW_CONTROLLER – Web Dynpro for ABAP – SAP Library
Hope that helps!