cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.ClassCastException: Modelname incompatible with java.util

udaykumar_kanike
Active Contributor
0 Kudos

please help me resolve this issue

java.lang.ClassCastException: se.abb01.Zexigo_Apprstatus_Rfc_Input incompatible with java.util.Collection

at se.abb.AppView1.onActionDisplayRecord(AppView1.java:177)

at se.abb.wdp.InternalAppView1.wdInvokeEventHandler(InternalAppView1.java:205)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)

... 26 more

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Please post the code which u wrote and also the entire stack trace of error.

udaykumar_kanike
Active Contributor
0 Kudos

This is the code which I wrote

// -


// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// -


package se.abb;

//

// IMPORTANT NOTE:

// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED

// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN

// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateAppView1).

// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY

// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS

// OF IMPORT STATEMENTS.

//

//@@begin imports

import java.util.Collection;

import com.sap.security.api.IUser;

import com.sap.security.api.IUserAccount;

import com.sap.security.api.UMException;

import com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException;

import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;

import com.sap.tc.webdynpro.progmodel.api.WDVisibility;

import com.sap.tc.webdynpro.progmodel.repository.IWDWindowInfo;

import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;

import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;

import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;

import com.sap.tc.webdynpro.services.session.api.IWDWindow;

import com.sun.org.apache.bcel.internal.generic.IUSHR;

import se.abb.wdp.IPrivateAppView1;

import se.abb01.Zexigo_Apprstatus_Rfc_Input;

import se.abb01.Zexigo_Apprstatus_Rfc_Output;

//@@end

//@@begin documentation

//@@end

public class AppView1

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(AppView1.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

/**

  • Private access to the generated Web Dynpro counterpart

  • for this controller class. </p>

*

  • Use <code>wdThis</code> to gain typed access to the context,

  • to trigger navigation via outbound plugs, to get and enable/disable

  • actions, fire declared events, and access used controllers and/or

  • component usages.

*

  • @see se.abb.wdp.IPrivateAppView1 for more details

*/

private final IPrivateAppView1 wdThis;

/**

  • Root node of this controller's context. </p>

*

  • Provides typed access not only to the elements of the root node

  • but also to all nodes in the context (methods node<i>XYZ</i>())

  • and their currently selected element (methods current<i>XYZ</i>Element()).

  • It also facilitates the creation of new elements for all nodes

  • (methods create<i>XYZ</i>Element()). </p>

*

  • @see se.abb.wdp.IPrivateAppView1.IContextNode for more details.

*/

private final IPrivateAppView1.IContextNode wdContext;

/**

  • A shortcut for <code>wdThis.wdGetAPI()</code>. </p>

  • Represents the generic API of the generic Web Dynpro counterpart

  • for this controller. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

/**

  • A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>

  • Represents the generic API of the Web Dynpro component this controller

  • belongs to. Can be used to access the message manager, the window manager,

  • to add/remove event handlers and so on. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public AppView1(IPrivateAppView1 wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

//@@begin javadoc:wdDoInit()

/** Hook method called to initialize controller. */

//@@end

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.currentContextElement().setResultVisibility(WDVisibility.VISIBLE);

wdContext.currentContextElement().getAppStat();

//@@end

}

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

//@@begin javadoc:wdDoModifyView

/**

  • Hook method called to modify a view just before rendering.

  • This method conceptually belongs to the view itself, not to the

  • controller (cf. MVC pattern).

  • It is made static to discourage a way of programming that

  • routinely stores references to UI elements in instance fields

  • for access by the view controller's event handlers, and so on.

  • The Web Dynpro programming model recommends that UI elements can

  • only be accessed by code executed within the call to this hook method.

*

  • @param wdThis Generated private interface of the view's controller, as

  • provided by Web Dynpro. Provides access to the view controller's

  • outgoing controller usages, etc.

  • @param wdContext Generated interface of the view's context, as provided

  • by Web Dynpro. Provides access to the view's data.

  • @param view The view's generic API, as provided by Web Dynpro.

  • Provides access to UI elements.

  • @param firstTime Indicates whether the hook is called for the first time

  • during the lifetime of the view.

*/

//@@end

public static void wdDoModifyView(IPrivateAppView1 wdThis, IPrivateAppView1.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

//@@end

}

//@@begin javadoc:onActionDisplayRecord(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionDisplayRecord(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionDisplayRecord(ServerEvent)

try{

IWDMessageManager msgMgr = wdThis.wdGetAPI().getComponent().getMessageManager();

String strUserid = null;

String Userid = null;

wdContext.currentContextElement().setResultVisibility(WDVisibility.NONE);

Zexigo_Apprstatus_Rfc_Input inp = new Zexigo_Apprstatus_Rfc_Input();

wdContext.nodeZexigo_Apprstatus_Rfc_Input().bind((Collection) inp);

inp.setIsdate(wdContext.currentContextElement().getSdate());

inp.setIedate(wdContext.currentContextElement().getEdate());

//inp.setIuser("SEYATRI");

//inp.setIstatus("20");

IWDClientUser wdClientUser = null;

try {

wdClientUser = WDClientUser.getCurrentUser();

} catch (WDUMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

IUser user = wdClientUser.getSAPUser();

if (user != null) {

IUserAccount[] acct = null;

try {

acct = user.getUserAccounts();

} catch (UMException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

if (acct[0] != null) {

Userid = acct[0].getLogonUid();

wdContext.currentZexigo_Apprstatus_Rfc_InputElement().setIuser(new String(strUserid));

inp.setIuser(Userid);

}

msgMgr.reportSuccess("Userid:"+Userid);

}

//call execute Method

wdContext.currentZexigo_Apprstatus_Rfc_InputElement().modelObject().execute();

//

wdThis.wdGetAppCompController().executeZexigo_Apprstatus_Rfc_Input();

}

catch(WDDynamicRFCExecuteException wddree){

wddree.printStackTrace(); }

//@@begin javadoc:onActionExit(ServerEvent)

/** Declared validating event handler. */

//@@end

}

//@@begin javadoc:onActionExit(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionExit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionExit(ServerEvent)

//@@end

}

//@@begin javadoc:onActionSelect(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSelect(ServerEvent)

String[] AppStat = null;

//wdContext.currentContextElement().setAppStat(AppStat);

//@@end

}

/*

  • The following code section can be used for any Java code that is

  • not to be visible to other controllers/views or that contains constructs

  • currently not supported directly by Web Dynpro (such as inner classes or

  • member variables etc.). </p>

*

  • Note: The content of this section is in no way managed/controlled

  • by the Web Dynpro Designtime or the Web Dynpro Runtime.

*/

//@@begin others

//@@end

}

Former Member
0 Kudos

Hi Uday,

In the following statement, why have you typcast inp to Collection?

wdContext.nodeZexigo_Apprstatus_Rfc_Input().bind((Collection) inp);

Can you try using the below statement (without casting to Collection):

wdContext.nodeZexigo_Apprstatus_Rfc_Input().bind(inp);

Regards,

Pavithra

udaykumar_kanike
Active Contributor
0 Kudos

I got this error in the browser

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(AppView1.AppStat): must not modify the datatype of a mapped attribute

at com.sap.tc.webdynpro.progmodel.context.MappedAttributeInfo.getModifiableSimpleType(MappedAttributeInfo.java:117)

at se.abb.AppView1.wdDoInit(AppView1.java:126)

at se.abb.wdp.InternalAppView1.wdDoInit(InternalAppView1.java:187)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

... 33 more

can you help me solve this issue

Qualiture
Active Contributor
0 Kudos

Have you changed the wdDoInit() method in the meantime?

In your code, I can only see

//@@begin javadoc:wdDoInit() 
/** Hook method called to initialize controller. */ 
//@@end 
public void wdDoInit() { 
    //@@begin wdDoInit() 
    wdContext.currentContextElement().setResultVisibility(WDVisibility.VISIBLE); 
    wdContext.currentContextElement().getAppStat(); 
    //@@end
}

which couldn't possibly throw the error you're getting.....

udaykumar_kanike
Active Contributor
0 Kudos

Hi John,

This code has already been inserted.

Kindly give me the alternate solution to resolve this issue.

Thanks

Uday

udaykumar_kanike
Active Contributor
0 Kudos

Sorry Rob,

I addressed with wrong name

Qualiture
Active Contributor
0 Kudos

What I mean is, the line in wdDoInit

wdContext.currentContextElement().getAppStat();

cannot have caused the error directly. Where does the mapped attribute appStat originate from, and are there differences between the original and mapped data type?

udaykumar_kanike
Active Contributor
0 Kudos

Hi Robin van het Hof,

I could solve this issue myself but your answers were very helpful in tracing the errors.

Thanks

Uday