cancel
Showing results for 
Search instead for 
Did you mean: 

How can we call methods of one web dynpro component in another one

Former Member
0 Kudos

Hello Team,

How do I call one Web Dynpro component methods in another Web Dynpro component.

How do we use public parts.

thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Raghu,

What i got from your question is you want to use the method available in some other DC in your DC. For this case three steps are required

1. The DC which is containing the method definition should expose the Method from interface controller and further exposing as public part.

2. The DC which is containing the method definition should be added as dependency to the DC in which you want to access/call the method.

Above two steps are explained in the thread link provided by above how ever still i think some part is missing which you should always consider when ever you want to do a inter application/DC communication which is 3rd step as follows.

3. if you want to use the method in component controller the reference of the used component should be added in to the reference of component controller which is some time done by default when you define used component. In case you want to use the method or context available in the other DC in View you need to define the reference of used component and interface in the reference of view which will not be done by default and very necessary.

Please check if the reference of the used component are available in proper place.

Regards

Jeetendra

Former Member
0 Kudos

Hi Raghu,

If you want to expose some methods which are in component controller to another component.

1. Create the same method in interface controller.

2. Call the component controllers method in interface controller method.

To use it in public part.

Let us suppose you are using two DC's named DC1 and DC2. And you want to use DC1 -> component in DC2 -> component. To achieve this follow the below steps:

1. Create a public part in DC1.

2. Add your Dc1 -> component to public part. (By right click on component and select Add to public part)

3. In the DC2, Add DC1 -> public part as used dc.

4. In DC2 -> Component go to used components and add the DC1 -> component.

5. You will have access to DC1 -> component -> interface controller. You can access all the methods from there.

Hope this clarifies!

Regards,

Jaya.

Former Member
0 Kudos

Hi,

You want to use Comp2's getData() method in Comp1

If both the WebDynpro components are in the same DC:

1. Create a wrapper method (with the same signature) in the Comp2's Interface controller. And invoke the Component contorller's getData() method in this method using the below code.

wdThis.wdGetComp2Controller.getData()

2. Now Go to the Comp1 and right click on UsedWebDynproComps and add this Comp2 as a UsedWebDypro component.

3. Now go to the Component Controller of Comp1 and in properties tab add the usage declaration of Interface controller of Comp2.

4. Now using this below code you can access the method of InterfaceController of Comp2.

wdThis.wdGetComp2Interface().getData();

If both the WebDynpro components are in different DCs:

1. Right click on Comp2 and select Add to public part on Comp2 in DC2.

2. Now Add this public part in DC1 UsedDCs.

Now repeat the above stpes 1...to..4. of "If both the WebDynpro components are in the same DC" same.

Regards,

Charan

former_member185029
Active Contributor
0 Kudos

Hi,

You will need to expose the fucntion through interface controller.

You will need to add this component as a resusable component (NWDI is must)

-Ashutosh