Entering content frame

This graphic is explained in the accompanying text Cross-Controller Method Call Locate the document in its SAP Library structure

The Web Dynpro framework enables the application developer to develop source code beyond the controller boundaries. The example of the previous chapter Action Event Handlers is used again to explain the procedure:

This graphic is explained in the accompanying text In the chapter Context Mapping, a cross-view context in the component controller and the required mapping for the example component have already been created. Now, the functions of the event handler of the action GO are to be tranferred to a method of the component controller.

Method of the Component Controller

In this example, the method is called SIMPLE_GET_FLIGHTS:

 

 

method SIMPLE_GET_FLIGHTS.

data:

INPUT_NODE type ref to IF_WD_CONTEXT_NODE,

      TABLE_NODE type ref to IF_WD_CONTEXT_NODE,

CAR        type STRING,

      FLIGHTS    type standard table of SPFLI.

 

  INPUT_NODE = WD_CONTEXT->GET_CHILD_NODE( 'INPUT_NODE' ).

 

   INPUT_NODE->GET_ATTRIBUTE( exporting Name = 'IN1'

                              importing Value = CAR ).

  FLIGHTS = CL_WD_FLIGHT_MODEL=>GET_FLIGHTS_BY_CARRID( CAR ).

 

TABLE_NODE = WD_CONTEXT->GET_CHILD_NODE( 'TABLE_NODE' ).

 

TABLE_NODE->BIND_ELEMENTS( FLIGHTS ).

endmethod.

   

 

 

The content of the method does not change, but the context in which the method is called changes. This means that, for example, the attribute WD_CONTEXT which is the reference to the local context, is no longer the context of the view but the context of the component controller.

Method Call of the Component Controller in the Event Handler of the View-Controller

The newly created method in the component controller must now be called in the event handler of the action GO in the view controller.

 

 

method ONACTIONGO.

 

       WD_COMP_CONTROLLER->SIMPLE_GET_FLIGHTS( ).

 

endmethod.

   

 

The attribute WD_COMP_CONTROLLER is a reference variable of the reference type IG_COMPONENTCONTROLLER and therefore a reference to the corresponding component controller. This is automatically known to each view controller of the component.

 

 

Leaving content frame