Skip to Content

Accessing Component Controller or Custom Controller in a context node class

Purpose: Accessing Component Controller or Custom Controller in a context node class

The COMP_CONTROLLER is a protected variable. Using reference to Window Controller will access the component controller.

1) In the View Controller’s Implementation class (ZL_XXXXX_IMPL) create a public instance method Get_Window ( ).

method GET_WINDOW.

    rr_window = me->view_manager->get_window_controller( ).

endmethod.

2) In the Context Node Class (CNXX), create a public instance variable gv_owner of type view controller’s implementation class (ZL_XXXXX_IMPL).

3) In the Context Node Class (CNXX) redefine the method IF_BSP_MODEL~INIT if needed with this code.

method IF_BSP_MODEL~INIT.   
   gv_owner ?= owner.

endmethod.


4) Accessing the component controller in the method ON_NEW_FOCUS of the Context Node Class (CNXX)

method ON_NEW_FOCUS.


DATA:lr_window TYPE REF TO cl_XXXXX_window_impl, ” Window Impl Class

     lr_comp   TYPE REF TO zl_XXXXX_bspwdcomponen_impl, ” Component Controller Impl class

     lr_access TYPE REF TO if_bol_bo_property_access,

     lr_vc     TYPE REF TO zl_XXXXX_impl. ” View Controller Impl class

    lr_vc      ?= gv_owner.

    lr_window  ?= lv_vc->get_window( ).

    lr_comp    ?= lr_window->m_parent.

    lr_access  ?= lr_comp->ztyped_context->gvproduct->collection_wrapper->get_current( ).

endmethod.

Thanks

Ram Vellanki

3 Comments
You must be Logged on to comment or reply to a post.
  • Hi Ram,

    Its good article for the all the CRM learners. I have one dobut here, i assumen that if we use the code as it is will give us a dump because the variable gv_owner is not bound. Do we need to assign instance of IMPL class or how it will fetch the instance of the IMPL class. Thanks.

    • Hi Dharmakasi,

          I forgot to mention a piece of code. Please add the below

      In the Context Node Class (CNXX) redefine the method IF_BSP_MODEL~INIT (if needed) include this code.

      method IF_BSP_MODEL~INIT.   
         gv_owner ?= owner.

      endmethod.



      Thanks

      Ram