Entering content frame

This graphic is explained in the accompanying text Component Usage with Controller Access Locate the document in its SAP Library structure

If you want to enable access to the interface controller of the external component from the current component – that is, if you want to change this controller’s data or use its functions – you must choose on the Properties tab page of the selected controller Sample Usage ® Foreign_component ® Interface Controller. In this case, both the component and the interface controller are explicitly included into the table.

This graphic is explained in the accompanying text

 

The usage was added to the metadata again.

Instantiating the Used Component

In accordance with the procedure described in the section above, the used component must be instantiated in an appropriate method of the component (see Component Usage without Controller Access).

Implementing Access to Methods of the Controller of a Used Component

If you now want to access the content of the used controller context or if you want to use methods of this controller, you have to expand the instantiation of the used component that is described above. To be able to do this, you must have entered the interface controller of the used component on the Properties tab page of the current controller (as described above). The usage declaration of the component is not enough in this case.

Procedure

...

       1.      Select another method on the Methods tab page. This can be – but does not have to be – the same method as in step 1. For example, you can instantiate the used component in a method of the component controller, so that you can then access its data or functions from different view controllers. However, you must ensure that the external component has been instantiated before the interface controller is accessed (see also The Phase Model in Part 1 of the programming manual).

       2.      Open the ABAP Editor by double-clicking on the name of the selected method.

       3.      Click again on the Web Dynpro Code Wizard button.

       4.      Select Method Call in the Used Controller.

       5.      Use the F4 help to open the Component Name row. All available components and their controllers are listed in a separate window.

       6.      Select the controller you require and confirm the dialog.

       7.      In the next step, display the F4 help for the Methods row and select the required controller method on the subsequent dialog.

       8.      Confirm the Wizard dialog.

The method of the controller for the used component that you selected was added to the coding of the method that you are currently editing. You can now use this function according to ABAP Objects programming.

Method WD_CPIFC_<MY_COMPONENT_USAGE>

If in addition to the component usage the usage of the related interface controller has been entered, the list of the local controller methods is extended by the method WD_CPIFC_<MY_COMPONENT_USAGE>. This method returns a reference variable of type IWCI_<USED_COMPONENT>, that is of the type of the ABAP-global interface of the used component.

This graphic is explained in the accompanying text Example: The entered component usage MY_COMP_USAGEincludes the component MY_USABLE_COMPONENT into the current component. Method WD_CPIFC_MY_COMP_USAGE of the local controller interface enables you to access the methods of the interface controller of the used component MY_USABLE_COMPONENT. For example, you can then use its method WD_GET_API to access the methods of the runtime API (see above) of the used interface controllers.

 

 method MY_CONTROLLER_METHOD .

 

data: L_REF_INTERFACECONTROLLER type ref to IWCI_MY_USABLE_COMPONENT,

      L_API_INTERFACECONTROLLER type ref to IF_WD_CONTROLLER.

 

 

  L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_MY_COMP_USAGE( ).

 

  L_API_INTERFACECONTROLLER = L_REF_INTERFACECONTROLLER->WD_GET_API( ).

 

 

endmethod.

 

 

 

Leaving content frame