cancel
Showing results for 
Search instead for 
Did you mean: 

how ot Access component 1 in component 2

former_member205429
Contributor
0 Kudos

Hi All,

Can any one pls let me know how to access Component 1 in component 2 ..

I have gone through few threads on Navigation between two different components using Component Interface and Component Usage.

http://scn.sap.com/docs/DOC-27478


But my requirement is not to navigate from component 1 to component 2, rather i need to access component 1 in component 2.

Pls help me asap !!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Santosh,

You can bind the controllers between component 1 and component 2 und WD_USAGE_INITIALIZE.

Best regards,

Thomas Wagner

former_member205429
Contributor
0 Kudos

Thomas,

I have done this in WD_USAGE_Initialize of the component controller.

Can u pls let me know how and when does this load the component 1 in component 2. ?

does this load during initialization of controller 2 ??

asking you little theoritically..

Former Member
0 Kudos

Component 1   and    Component 2

Component 1 there is a view which needs to be reused in component 2 .

Component 1- Create an interface view. Add context in the interface controller.

Component 2- Create a component usage in component 2. Now you can add the view to any window or viewset.

  Redefine the method WD_USAGE_INITIALIZE in component2 and bind the context of both the component controller controller.

Bind the respect view's to respective component controller's of the component 1 & 2.

Now coming to navigation.

Navigation happens on click of button or hyperlink.

Assume there is button on component1 and click of this button will take you to component 2.

Component 1 - Button - event handler - fire outbound plug of the same view.

Inside this outbound plug - get the reference of the window where the view is added and fire its outbound plug (window's).

at this point you need to call a navigation link.

For this create an inbound plug in the component 2's window.

create a navigation link in the component 1's (Component1's window outbound plug to component's  2's inbound plug)  and call it from window's outbound plug of component1.

Hope this helps.

THanks and Regards,

Nikhil Kulkarni

former_member205429
Contributor
0 Kudos

Nikhil,

Thaanks for the input.

I am looking for navigation between two components.

I just need the access of component 1 in component 2.

I have created WD_USAGE_INITIALIZE in Component 2.

My doubt : is there anything else required or just defining the WD_USAGE_INITILIAZE would suffice to access the component.

Former Member
0 Kudos

WD_USAGE_INITILIAZE method is the method used to bind the two context of teo different component. (Once the component1's context node is filled with value then it can be accessed in compnoent 2's context node to which you have done binding in this method).

take an example. I have created one view in my component and you want to reuse that in your component.

My task is to just expose that as interface view.

you have to the component usage in you component. Once component usage is done you can add it to any window / view set / overview page.

If you want to share the data , then we will implement WD_USAGE_INITILIAZE method.

Thanks and regards,

nikhil

former_member205429
Contributor
0 Kudos

Nikhil,

is it that the Context nodes in the Component Interface view are same as the ones we create in the component controller Context Nodes.

.i.e. is it like we can only add those context nodes which are defined in the COmponent controller in the Component Interface ( COntext Nodes )

i am asking this because, when we add interface view into COmponent Interface, we need to give the Window ( usually its a main window ).w.r.t context nodes what is the funda in COmponent Interface ..

Can u pls confirm/ CLarify me

Former Member
0 Kudos

The context nodes which you add in the interface view are the context nodes coming from component controller of that component.

The reason why we add the context nodes here is :

THese context nodes have to be exposed because in the other component where you done the component usage need, refer to these context nodes and understand that these are involved in the data communication.

There will be a dump if you are not adding the context nodes over here.

Thanks and Regards,

Nikhil