Entering content frame

Procedure documentation Calling (Sub) Controllers Locate the document in its SAP Library structure

Use

Sub-controllers can be instantiated and called by a subordinate controller (main controller) or by a view or a page.

Recommendation

We recommend that a subordinate controller in method DO_INIT creates a sub-controller, sets the parameters accordingly and then calls the sub-controller from the appropriate view.

Prerequisites

Calling a Controller

  1. Create the controller instance. You have the following options:

or

application_namespace and application_name are optional. Unless you specify otherwise, the system uses the current values.

Note

You can also specify each of the controller IDs.

  1. If necessary, set the request parameters:
  2. l_ctrl->do_initattributes( ).

  3. Set additional attributes:
  4. l_ctrl->set_attribute( name = name value = value ).

  5. Call the request:

call_controller( l_ctrl ).

Calling (Sub) Controllers

  1. Instantiate your sub-controller.
    Create your sub-controller in method
    DO_INIT:
    subcontroller = create_controller (controller_name = ‚name.do‘
                                     controller_id = 'id' ).
  2. Example:
    flightdetails ?= create_controller( controller_name = 'flightdetails.do'
                                     controller_id = 'fld' ).

    Note
    Ensure that the controller_id is specified.

  3. Call your sub-controller.
    1. You can execute the call from the controller.
      This makes sense in particular if the calling controller does not control a layout. There are two call options here:

or

    1. You can execute the call from the view. There are three call options here, which are all implemented using the <bsp:call> BSP element. The comp_id used here corresponds to the controller_id from create_controller.
  1. Determine the parameter transfer.
    1. You can execute the parameter transfer from the controller.
    1. You can execute the parameter transfer from the view.

<bsp:call>
  <bsp:parameter name = "…" value = "…" />
</bsp:call>

 

 

Leaving content frame