cancel
Showing results for 
Search instead for 
Did you mean: 

Accesing the component controller in the assistance class

Former Member
0 Kudos

I have a need where I want to use the component controller in the assistance class.

I am writing a method (static or instance) in the assistance class that will take the WD_COMP_CONTROLLER variable as a import parameter and make a method call on the wd_comp_controller.

This assistance class method will be called from anywhere in the component.

How do I do this?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Prashant,

Did you check this

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Maksim Rashchynski ,

This is not what I want to do. I can acess the component controller from everywhere in the component using the WD_COMP_CONTROLLER attribute.

I want to pass the WD_COMP_CONTROLLER to a method in the assistance class (instance variable WD_ASSIST).

Question is how do I pass it. WD_COMP_CONTROLLER is of the type IG_COMPONENTCONTROLLER and it is available only within the component and not outside the component. The assistance class is outside the component.

I hope I could explain it correctly.

sridhar_k2
Active Contributor
0 Kudos

Hi Prashant,

As for i know,If you want to access Out Side Component, You need to Expose that component in the (Source Project)Public Parts-> New Public Part. from DTR.

You Can access the Same component from (Target Project)Used Dc's. -> Add Used DC.

With out using DTR or Some Other tool, you can't access other components.

Correct me, if i am wrong.

Regards,

Sridhar

thomas_szcs
Active Contributor
0 Kudos

Hi Prashant,

The class that represents the component controller is a local class within the web dynpro component. It is not possible to pass a pointer to it to any class outside easily.

Nonetheless, you could pass the pointer as type ref to object and obtain an rtti object of wd_comp_controller. Inside of that other class, you could then use dynamic programming to access the properties and methods of the component controller. All of that is not advised.

Very likely, you want to do specific things, like modifying the context of the component controller. It is always better to pass the specific object (e.g. the root node of the context) to that other class).

In case you would like to call methods of the component controller from a class outside of the component, consider moving the coding of that method to the assistance class. Then you will be able to call it easily.

Best regards,

Thomas

Former Member
0 Kudos

Thanks Thomas. I got the answer. IT was helpful and I have awarded you points