Skip to Content
author's profile photo Former Member
Former Member

Factory method problem using two models

I'm currently developing an application using two controllers and two models and I'm running into problems which I think are being caused by the WDModelFactory class.

The first controller and (RFC) model I made are used for retrieving a set of customers from an R/3 system. I've made a view that uses a table control to present all the customers on screen. This works fine. I also have a button on this screen that triggers an outbound plug of the view. This outbound plug is connected to an inbound plug of the view that should present the details of the selected customer. When I fire the outbound plug an exception occurs which seems to be caused by a statement in the wdDoInit method of the second controller. I've determined that the error is caused by a call to the WDModelFactory class.

When I execute the statement "DetailsModel = (Mdl_Details)WDModelFactory.getModelInstance( Mdl_Details.class, WDModelScopeType.APPLICATION_SCOPE);" I get a ClassCastException error. In the error information I can see that the error occurs not in the CustomerDetails model but in the CustomerList model! It seems to me that the factory method is in fact not returning an instance of a CustomerDetails model but an instance of a CustomerList model. I think this is a problem in the WDModelFactory class.

Has anybody else had this problem, or is it just me?

We are using beta II

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2003 at 05:56 PM

    Hi Bertil,

    Could you please check if the model in each controller is specified correctly?

    An alternative would be to create a single model that contains the RFC proxies for both BAPI's. Then you would only need to create a single model object. Once this is done, a reference to the model object should be stored in the context of the component controller. The reference to this model can then be picked up by any view controller that uses the component controller. Thus, models are created at component controller initialisation time, and used on an "as needed" basis by the view controllers.

    Hope that helps!


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.