cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a method in another webdynpro component

Former Member
0 Kudos

Hi,

I have two webdynpro components say Comp A and Comp B.

In Comp A I had a view View A and in Comp B I had a View in View B.

In View A, I had a method X, I want to call this method in View B of Comp B.

How I can do this?

I created a public part of Comp A and tried to add in used webdynpro components. But in the list I am not able to find it.

Please help.

Regards

MQ

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi MQ,

The Component Controller is a private entity of a Development component. Any external DC cannot access the component controller of another DC.

In order for other components to use the functionality you will have to create methods in the Interface Controller. Which are like a wrapper around the methods of the component controller. You can also create context attributes or nodes and map them to the Component Controller.

After the public parts are created and the dc is added as a used DC and used component to another DC. You can use the methods only in the interface controller. Also, the context of the external DC component controller can be mapped to the interface controller.

Regards,

Kartikaye

Former Member
0 Kudos

Hi,

if you want to use the method in the two components, you need to right this method under the component controller of the parent component(comp A).

then you can call same method in the interface controller of the same component(Comp A).

add the parent component(Comp A) as a used webDynpro component in the Child component (Comp B).

go to the data modular view of your comp B and map the interface controller of comp A to component controller of comp B.

then you can call the method available in the interface controller of Comp A to component controlelr of Comp B.

Cheers,

Apparao

gill367
Active Contributor
0 Kudos

Hi,

You can do this by using Interface controller of the component A.

In the interface controller of comp A declare a new method and call the method from view A in this.

The method present in the interface controller of comp A can be accessed by view of comp B.

Add interface controller of comp A in the required controller of view B 's properties Tab.

hope it solves your problem.

Thanks,

Sarbjeet Singh

Former Member
0 Kudos

Hi,

If both the components Comp A and Comp B are in the same DC you can use the interface controller to call the method in comp A. Add this comp A interface controller in Comp B controller by going to the properties tab, so that you can access the methods of comp A interface controller.

If you have the components in different DC's you can follow the below steps:

Go to public parts in DC meta data section and create a public part by selecting the first radio button option and add the Comp A by selecting the option (Webdynpro Component-->Selected Entities).

Click on Finish button so that public part for comp A is created.

Now build the DC and go to Used Webdynpro components of CompB, give some name and browse to select the used webdynpro component, it will show you the Comp A public part select it and try to finish it.

Once again build the Dc after doing this.

Now you can access the method of comp A in Comp B

wdThis.wdGetCompA.getX()...

Hope this helps you..

Regards,

Saleem