on 11-16-2006 2:13 PM
Hi Again.
This question refers to the problem discussed here:
Now I have some further questions.
1.
I have a main component which uses, let's say 10 subcomponents. Everytime I
click a button I want to loop over all component usages and find the currently
active component in order to delete it. I do not find a method where I can get all
component usages I have defined in my main component. So at the moment I
have to define hard code each component usage access instead of looping over all
usages.
method RESET_ACTIVE_COMPONENTS .
DATA: lr_usage TYPE REF TO if_wd_component_usage.
lr_usage = wd_this->wd_cpuse_MB58( ).
IF lr_usage->has_active_component( ) IS NOT INITIAL.
lr_usage->delete_component( ).
ENDIF.
lr_usage = wd_this->wd_cpuse_SDORDER( ).
IF lr_usage->has_active_component( ) IS NOT INITIAL.
lr_usage->delete_component( ).
ENDIF.
endmethod.
Is there a generic way to get all component usages?
2.
Befor calling the delete_component method I want to call a method in this
component to check whether there is a transaction in progress. If so I would
not call the delete method but open a pop up. This method should be available in
each subcomponent.
So I defined a component interface (ZIWCI_ZFR_PROGRESS) which only has this
method and this interface is implemented by each of my subcomponents.
Now I tried to extend the above method in the following way:
method RESET_ACTIVE_COMPONENTS .
DATA: lr_usage TYPE REF TO if_wd_component_usage,
l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI_ZFR_PROGRESS,
inProgress TYPE wdy_boolean.
lr_usage = wd_this->wd_cpuse_MB58( ).
IF lr_usage->has_active_component( ) IS NOT INITIAL.
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_MB58( ).
l_ref_INTERFACECONTROLLER->Is_In_Progress(
importing
IN_PROGRESS = inProgress
).
lr_usage->delete_component( ).
ENDIF.
lr_usage = wd_this->wd_cpuse_SDORDER( ).
IF lr_usage->has_active_component( ) IS NOT INITIAL.
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_Sdorder( ).
l_ref_INTERFACECONTROLLER->Is_In_Progress(
importing
IN_PROGRESS = inProgress
).
lr_usage->delete_component( ).
ENDIF.
endmethod.
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_MB58( ).
unfortunatley do not work because the interface controller of each sub
component has its own interface type. I do not want to define each interface
type here to access the method I defined in the interface component.
Seems not to be object oriented. Or do I get something worng? Isn't this
managable in a generic way?
Sorry for the long post and thank you in advance.
Best regards,
Sascha
Message was edited by:
Sascha Dingeldey
Hi Sascha,
1. could be solved by using ComponentUsageGroups, but that's hard stuff so to say. You will lose all design-time support, but get the chance to do things totally feely and dynamically.
2. Have you defined the component usage to the component interface instead of to the specific component?
Best regards,
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas.
Lol stupid me:
To 2. A simple cast of the component interface controller used into the implemented interface is doing the job.
...
IF lr_usage->has_active_component( ) IS NOT INITIAL.
l_ref_INTERFACECONTROLLER <b>?=</b> wd_This->wd_CpIfc_MB58( ).
...
To 1. I thought component usage groups are grouping usages which refer to the same used coimponents.
Is there a way to dynamically define a new component usage in a component?
Chers Sascha
Message was edited by:
Sascha Dingeldey
from a doc
method MY_CONTROLLER_METHOD .
data: L_COMPONENT_USAGE type ref to IF_WD_COMPONENT_USAGE,
L_MY_INITIAL_USAGE type ref to IF_WD_COMPONENT_USAGE.
L_MY_INITIAL_USAGE = WD_THIS->WD_CPUSE_MY_INITAL_USAGE( ).
L_COMPONENT_USAGE = L_MY_INITIAL_USAGE->CREATE_COMP_USAGE_OF_SAME_TYPE(
<NAME_OF_THE_SECOND_USAGE> ).
.
.
endmethod.
data: L_CMP_API type ref to IF_WD_COMPONENT,
L_CMP_USAGE_GROUP type ref to IF_WD_COMPONENT_USAGE_GROUP.
L_CMP_API = WD_THIS->WD_GET_API( ).
if L_CMP_API->HAS_CMP_USAGE_GROUP( TESTGROUP ) is initial.
WD_THIS->CMP_USAGE_GROUP = L_CMP_API->CREATE_CMP_USAGE_GROUP(
NAME = TESTGROUP
USED_COMPONENT = <name used component>).
endif..
WD_THIS->CMP_USAGE_GROUP->ADD_COMPONENT_USAGE(
NAME =USAGE1
EMBEDDING_POSITION = <Name View>/<Name Container>
USED_COMPONENT = <Name used component> ).
WD_THIS->CMP_USAGE_GROUP->ADD_COMPONENT_USAGE(
NAME =USAGE2
EMBEDDING_POSITION = <Name View>/<Name Container>
USED_COMPONENT = <Name used component> ).
EMBEDDING_POSITION = <Name View>/<Name Container>.<Name Sub-view>/<Name
Container2>*
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.