on 02-01-2011 3:57 PM
Hi,
I have a SAP std component A that communicates to SAP std component B via just 1 component controller method that has "interface" checkbox set. There are no other objects part of the interface controller.
I have adjusted component B with an enhancement implementation to add more fields to a view. I want to pass these fields back to component A. I cannot do any cross component context mapping as no context nodes have been flagged as interface nodes.
I do not want to "bodge" the one interace method, and say for example, call it twice, once "for real" and the second time to pass my new data in a string field.
I have created a custom component C that has just a component controller context (with nodes set to interface nodes), and two interface methods - set_attributes and get_attributes. I declare usage of component C in both A and B.
In SAP std component B I use the following code to instantiate usage of component C as follows:
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usage_prt_helper( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
And this works fine, and I can then call my SET method. However, when in component A I also check the usage as above (I have to, else component A thinks C is not instantiated), unfortunately it creates another usage of C, which seems to be a separate instantiation, and thus two different sets of context.
Anyone know if I can check and reuse the one object instantiation of C that was created in component B in component A? Perhaps somewhere in CL_WDR_COMPONENT_USAGE?
Thanks very much in advance.
Hi Jon,
There are couple of things i would like to suggest.
If the purpose of this custom component is only to provide information regarding extra context attributes you have. Then you may consider a ABAP OO singelon class to transfer data between these two Components. This is much faster than a custom component.
Regarding the component instantiation question you have to evaluate the two possibilities
1. ENTER_REFERENCING_MODE [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/cd4416067f0a55e10000000a421937/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/cd4416067f0a55e10000000a421937/content.htm]
2. Component usage_group
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/f74c1448bc3255e10000000a1553f7/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/f74c1448bc3255e10000000a1553f7/content.htm]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
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.