cancel
Showing results for 
Search instead for 
Did you mean: 

What is the Difference between CustomController and ComponentController?

Former Member
0 Kudos

Hi All,

I have a small doubt. Regarding this what is the Diff betweeb Custom and component controllers.

In there any specific restriction to use only custom or component some kinds of senarios.

Thanks in Advance.

Mandapati

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Custom Controller is mainly used to connect external models like BAPI, Web Service, Java Bean. The advantage of this is that it can be reimported easily without disturbing mapping of the views.

Component Controller is used to hold all attributes including the Custom Controller.

Overall usage of Custom Controller is easy maintenance of operations on attributes, like deletion, mapping etc.

Regards,

Srinivasan T

<b>Helpful answer=>points</b>

Answers (4)

Answers (4)

Former Member
0 Kudos

hi nageswara rao,

one more main advantage of using custum controller is:

1) let us say all the model u added to component controller..., if the no.of model become more...the size of the contructor on component controller will increase..i.e above 65k which is maximum limit to any method.

if u need to add more model to this controller.. u cant, because, the signature of the method will store in the component controller....so it already exceeded the limit.

then u can need to add another controller, that is custome controller....now u can added some more models to it...

hope u understand it...

regards

-


sunil

Former Member
0 Kudos

Hi,

see also http://help.sap.com/saphelp_nw2004s/helpdata/en/b9/b82c4142aef623e10000000a155106/frameset.htm for information on the different types of controllers.

Regards, Heidi

Former Member
0 Kudos

Hi Rao,

Both Custom controller and Component controller are used to connect to R/3 etc..The benifit of Custom controller lies in providing easy maintenance, bcoz it provides easy reimporting without affecting the View, suppose if you use the CC to connect to the R/3 you should delete the BAPI i/p node from CC and the binded Views.In the Case of using Custom controller, it is eliminated.

Most importantly, custom controller's value nodes should be binded to the Component controller and then to the view.No direct link between Custom controller and View.

Kind Regards,

Saravanan K

Former Member
0 Kudos

Hi,

Each Web Dynpro component contains exactly one <b>component controller</b>. This controller is automatically created during the component creation and contains a context, events, and methods. Unlike a view controller, the component controller is visible for all views in a component. This means, the controllers of different component views can access context elements or methods of the component controller. For this purpose, the component controller usage is automatically created for every view controller.

This makes the component controller a central location for data exchange between different views of one component. The Web Dynpro framework provides the mechanism of context mapping which is a declarative tool to easily perform this data exchange.

In addition, the component controller allows cross-view method calls. For example, it might be useful to add the call of a function module to a method of the component controller if the function module is to be used by methods of different views. You can then access the methods of the component controller in the controllers of the various views. This enables you to structure Web Dynpro components in a better way and to reuse frequently used program steps.

<b>Custom controllers</b> are similar to the component controller in that they too have no visual interface. However, the existence of custom controllers is controlled entirely by the Web Dynpro developer at design time. Declaring the existence of a Web Dynpro Component causes the component controller to be created automatically, but this is not the case with custom controllers. Custom controllers are only created by an explicit design time declaration.

<i>When should a custom controller be used?</i>

Custom controllers should be created only when their presence will simplify the overall structure of the component. The principles to follow for deciding when a custom controller is needed are:

Reuse

Create a custom controller if you have identified a reuse case for a specific unit of code required by several other controllers within the component.

Task separation

To avoid placing too much coding in the component controller (and thereby potentially increasing its initialization time), place coding dedicated to a specific task into a separate custom controller

Lifespan of custom controllers

The lifespan of a custom controller is determined by a parameter setting made during the design time declaration. It can be either Framework Controlled or On demand.

If you choose Framework Controlled, then the Web Dynpro Framework will instantiate the custom controller when the component is instantiated.

If however, you choose On demand, then the Web Dynpro developer must write the coding necessary to instantiate the custom controller.

All this is from the SAP help, btw. You can find the information here:

1. http://help.sap.com/saphelp_nw2004s/helpdata/en/e2/434941d

b42f423e10000000a155106/frameset.htm

and 2. http://help.sap.com/saphelp_nw2004s/helpdata/en/44/0dca942d9d1ca2e10000000a11466f/frameset.htm

Regards,

Satyajit.