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

A problem in calling a subcontroller

I try to use the model class and call a subcontroller class to display data in another view by using the following code.

<b>In the do_init of main controller</b>

* Create the model of this class
l_model = create_model( model_id = c_model_id
class_name = lc_class_name ).

* Create sub controller
l_controller ?= create_controller(
                      controller_name = lc_control_name
                      controller_id   = c_subcontrol_id ).
controller_set_active( controller_id = c_subcontrol_id
                       active        = 0 ).
l_controller->set_model( model_id       = c_model_id
                         model_instance = l_model ).

<b>In the dispatch_input( ) of main subcontroller</b>

main_view = create_view( view_name = 'main.htm' ).

l_model ?= get_model( c_model_id ).

<i>*To separate tasks between calling a view and calling *a subcontroller, I have to have a flag, current_event, *to check whether the coming event is search. This flag *is set at the method 'do_handle_event'</i>

if current_event eq lc_search.
   l_subcontrol ?= get_controller( 
                      controller_id =   c_subcontrol_id ).
   controller_set_active( controller_id = c_subcontrol_id
                          active        = 1 ).
   call_controller( l_subcontrol ).
   clear current_event.
elseif current_event is initial.
   call_view( main_view ).

In <b>the do_request of my subcontroller class</b>, I call the view of the subroutine.

<b>dispatch_input( ).</b>
l_model ?= get_model( 'mm' ).

stock_view = create_view( view_name = 'stock.htm' ).
          name = 't_display' value = l_model->t_display ).
stock_view->set_attribute( name = 'ITERATOR' value = me ).
stock_view->set_attribute( name  = 'show_popup' 
                           value = show_popup ).
call_view( stock_view ).

After any event occurs in this view of subroutine, I catch this event at <b>the method do_handle_evnt</b>.

if htmlb_event is bound.

   case htmlb_event->server_event.
     when 'onSelect'.


       tv ?= cl_htmlb_manager=>get_data(
                               request = request
                               name = 'tableView'
                               id = 'stock_tv_display' ).
       if tv is not initial.
          table_event = tv->data.
          row_index = table_event->row_index.
          if row_index is not initial.
             show_popup = abap_true.

     when others.

After the program run through this method, it goes back to the do_request of the parent controller, without passing the do_request of subcontroller. This is my problem. I don't want to call the parent controller again. And, my application has already been stateful. Is there any way to prevent it? Please give me some suggestions to solve this problem.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 17, 2005 at 07:55 AM


    before we go any further into your problem, here is an important thing to know:

    The method DISPATCH_INPUT is not to be overwritten - it's purpose is to just get called within DO_REQUEST of your main controller, such as to have all input values passed on to the subcontrollers.

    It also says so in the method implementation of DISPATCH_INPUT in CL_BSP_CONTROLLER2:

    <b>* ...

    • This method should normally not be overwritten, besides the handling must be changed

    • ...</b>

    Also, as I saw you posting somewhere else that you are another user/person - please do not use multiple accounts. You can always ask the SDN staff to solve problems with your accounts (if you can't use your first anymore), but creating a new one is not the way it should be.

    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.