Skip to Content
author's profile photo Former Member
Former Member

Instance of IMPL class in custom controller


I have a requirement where i need a instance of view controller class(impl) in custom controller class. When i am trying to create an instance attribute of impl class in cuco and trying to use in one of the cuco methods then it is not getting initialized. Let me know how to do achieve this.

Thanks a lot.



Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 10, 2012 at 07:01 AM

    Hi Lisa,

    You can try the following to get instance of view controller (IMPL) class in a custom controller. This needs to be done inside the method of a custom controller where you want the instance of view controller class.

    1. Define an instance variable with Type Ref To <your impl class>

    2. Define lr_window Type Ref To CL_BSP_WD_WINDOW.

    3. use the attribute view_manager to get the window controller

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

    4. view_controller_instance ?= lr_window->get_subcontroller_by_viewname( 'view_name').

    here view_name would the name of view for which instance is required.



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      I have a similar requirement. my view is in an Overview page which is with in the Window. So I followed the same process as given. I have the instance of the main window but lr_ovp remains null.

      lr_window ?= me->m_parent.

      IF lr_window IS BOUND.

      lr_ovp ?= lr_window->get_subcontroller_by_viewname( 'ZPDA_CLOSE/ZPDACloseOVP' ).

      IF lr_ovp IS BOUND.

      lr_custidview ?= lr_window->get_subcontroller_by_viewname( 'ZPDA_CLOSE/ZCustId' ).

      Please help.

      PS:This is a total custom component.

  • Posted on Jan 10, 2012 at 09:11 AM


    You can use this syntax,

    lr_view ?= get_subcontroller_by_viewname( 'BP_HEAD/BPHEADOverview' )..

    Here Lr_view should be type ref to the view controller class.

    'BP_HEAD/BPHEADOverview' is the view name

    Regards ,

    Ratna Rajesh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.