
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 . In this case, both the component and the interface controller are explicitly included into the table.
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
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.
Example: Example: The entered component usage MY_COMP_USAGE includes 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.