cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Question regarding component Controller and component interface

Former Member
0 Kudos

Hello,

When I want to create a function on the Component level, where should I put it: At the component Controller or at the component interface and why?

And after I created such function how can I activate it from a certain view inside this component?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Roy,

1. If your function defined on Component Interface it is available for other components (that will embed your component). Also it is available as described in [2].

2. If function defined in Component Controller or Custom Controller it is available to any controller within your component (Interface, View, Custom) but not available outside.

3. If function defined in View Controller, then it is available only to this view controller.

[1] and [2] assumes adding controller via "Required Controllers" list on "Properties" tab of embeder.

VS

Former Member
0 Kudos

Dear Valery,

Thank you for your simple and clear explanation.

So, assuming I want to define a function that will be available to all the views inside this component I will define it inside the Component Controller.

What is the exact syntax to reach such a function from an embedded view?

Former Member
0 Kudos

Hi Roy,

Methods in the component controller are written when u want to write global function which u want to access in all the views of the component.If u want to expose some of ur functions to other components then u use interface controller.

If u want to access a method in the component controller from the view in the same component add the controller to the required controllers in the properties tab and in the view implementation access it using

wdThis.wdget<<Comp Controller Name>>.<<Method Name>>.

If u want to access the function of the interface controller in the other components add the public part to the used Dc's ,Add the component in the Used WebDynpro Components and then add the interface controller to the required controllers in the properties tab and in the view implementation access it using

wdThis.wdget<<Interface controller Name>>.<<Method Name>>.

Hope this answers ur question.

Former Member
0 Kudos

Hello Sowjanya,

I have created a public test method at the component controller but when I use in a certain view this syntax:wdThis.wdget<<Comp Controller Name>>. I don't receive the method I've created (I've rebuilt the porject after I've created the function and before I tried to access it from a certain view). Am I missing something here? what did you mean when you said: "If u want to access the function of the interface controller in the other components add the public part to the used Dc's ,Add the component in the Used WebDynpro Components..."?

Former Member
0 Kudos

Hi,

Check the properties tab of the view and make sure you have added the required controller there to access the method from the view.

Hope your earlier query was solved. If positive do close the same.

Regards

Noufal

Former Member
0 Kudos

Hi Roy,

I think u didnot add ur component controller in the required controllers in the view properties tab.Then only u will be able to access the component controllers method and context value attributes.Just check it.

Suppose U are developing a two webdynpro development components say dc1 and dc2.If u want to access the component of dc2 in dc1 you use that procedure I mentioned for interface controller.

Former Member
0 Kudos

Hey Noufal,

Well, I did that but I still can reach the function.

It is OK that I write the function on the @@begin others block of the Component controller right?

Former Member
0 Kudos

Hi Roy,

The function written in the @@Begin others block is only accessible within the component .It is not visible to other controllers or views.

Former Member
0 Kudos

Hi,

You will have to give the name of the method in the method tab of the component controller.

The method is created automatically. The implementation can be given iinside that.

Regards

Noufal

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Roy,

in your Component Controller or Custom Controller go to the Method tab , select New, create methods as per your requirement i.e. method or event handler, you can also mention some parameters. In the implementation body the signature of the method will be created as per this configuration. Write your code in that place. The Others section is only for local usage so it wont be visible to other controllers.

Shubhadip

Former Member
0 Kudos

Oh 10X you two, you are right, it is working now...

Former Member
0 Kudos