There are two ways to access Component Controller or Custom Controller in a context node class.
Approach-1:
1) In the View Controller’s Implementation class (ZL_XXXXX_IMPL) create a public instance attribute of type Component Controller’s IMPL class (ZL_XXXX_BSPWDCOMPONEN_IMPL).
2) Redefine the method WD_CREATE_CONTEXT of View Controller’s Implementation class
(ZL_XXXXX_IMPL) and add the below line of code.
GV_COMP_CNTRL ?= me->comp_controller.
3) In the Context Node Class (CNXX), create a public instance variable gv_owner of type view controller’s implementation class (ZL_XXXXX_IMPL).
4) Redefine the method IF_BSP_MODEL~INIT of the Context Node Class (CNXX)
method IF_BSP_MODEL~INIT.
CALL METHOD SUPER->IF_BSP_MODEL~INIT
EXPORTING
ID = id
OWNER = owner.
gv_owner ?= owner.
endmethod.
5) I will access the component controller in the method ON_NEW_FOCUS of the Context Node Class (CNXX)
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( ).
Approach-2: In my previous blog i explained this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |