on 05-03-2013 10:34 AM
Hi all,
I would like to share a context between two component of the same applicatio, by reading some other posts I try to do it by it doesn't work, what I did is:
1. I create an interface controller in which I put a node like the ones I want share, then I declare a method GET_NODE too.
2. In my components A and B I declare the Interface controller.
3. In component A I declare the node like an interface node and I implement the method GET_NODE of interface controller in order to read my node.
4. In component B I map the node to share with interface node of interface controller in component A.
5. In component B I implement following code in order to read the context of component A:
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
DATA lo_node_detail TYPE REF TO if_wd_context_node.
lo_cmp_usage = wd_this->wd_cpuse_cnt_carta( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO ziwci_fc_wda_cntcarta .
lo_interfacecontroller = wd_this->wd_cpifc_cnt_carta( ).
lo_interfacecontroller->get_node(
IMPORTING
node = lo_node_detail " ref to if_wd_context_node
).
Unfortunately it doesn't work... any suggest for me?
Thanks
GN
Hello,
Please create a method in Component controller of Component A and make it as Interface method.
write your code of data retreival and attach the data to the node.
Call the interface method in Component B which you are executing , may be you can call in Init method and now you can see the data is retreived.
Please dont write code for Mapping of nodes from comp A to B becuase as said by other members you can just bind the Interface node of Comp A to Comp B by right click from node B.
Code you can use like below in Init method of Comp B to call the Comp A Interface method for data retreival.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
DATA lo_node_detail TYPE REF TO if_wd_context_node.
lo_cmp_usage = wd_this->wd_cpuse_cnt_carta( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO ziwci_fc_wda_cntcarta .
lo_interfacecontroller = wd_this->wd_cpifc_cnt_carta( ).
lo_interfacecontroller->get_details( ).
Get details is the interface method created in Comp A.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gabriele,
If you have defined the component controller's context node in Component A as an interface node (by checking the relevant checkbox in the context node's properties) and then assigned Component A as a used component in Component B, you will be able to just map the interface node from Component A's context to Component B's context by drag-and-drop.
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If you have mapped the context of both the components, then you can use the context of the component B as both the context will have the same data(since they are mapped). I don't feel the need to create a special method to do the work.
Regards
Swati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.