08-23-2007 8:46 AM
hello,
I created the following scenario:
- I have a Main-component "m"
- "L" is a component interface definition (cid) which force both cid-L-implementating components "L1" and "L2" to extend and fill the method "set_COMP_USAGES()".
- I have other cid´s (A-C) too
- at runtime only one of the components "L1" or "L2" is created and the mother-component M holds component-usages (ref to) of the chosen variants of A-C and L as an attribute in the component-controller of m.
now my problem: my aim is to call a method in m at runtime which is defined at designtime in my cid L (set_COMP_USAGES() )and decided at runtime which variant of this method is chosen (the one from L1 or L2). in this method the references of comp_usages other cid´s should be passed to L1 or L2.
or short: how can I call a method from a cid-implementating component at runtime via a IF_WD_COMPONENT_USAGE reference (ref to) to this component?
08-23-2007 8:59 AM
I got the solution:
data: L_INTF_CONTROLLER type ref to ZIWCI_Z_ITF_CID_L.
L_INTF_CONTROLLER ?= wd_this->COMPONENT_USAGE_L->GET_INTERFACE_CONTROLLER( ).
CALL METHOD l_intf_controller->set_comp_usages
EXPORTING
comp_usage_a = wd_this->COMPONENT_USAGE_a
comp_usage_b = wd_this->COMPONENT_USAGE_b
comp_usage_c = wd_this->COMPONENT_USAGE_c.