on 06-24-2005 8:18 AM
I am binding a input field to a model attribute ...after deploying the appln the input field is disabled....I searched the forum and got the following
Re: Inputfield is getting disabled for input
Posted: Apr 2, 2005 4:31 AM Reply E-mail this post
Hi Akash,
When u bind a value attribute under a value node which has a cardinality of 0-n or 0-1 to the input field u should first create a node element and bind it to the node .Check the below code.
iprivate<<ViewName>>.I<<Node>> Element nodeEl = wdcontext.create<<Node>>Element;
wdContext.node<ValueNode>.addElement(nodeEl);
i did as stated above but now i am getting the following exception
java.lang.NullPointerException
at com.sap.tc.webdynpro.progmodel.context.Node.prepareAddElement(Node.java:698)
at com.sap.tc.webdynpro.progmodel.context.Node.addElement(Node.java:685)
at com.apil.hssp.webdynpro.hsspprocesses.LoginPage.wdDoInit(LoginPage.java:99)
at com.apil.hssp.webdynpro.hsspprocesses.wdp.InternalLoginPage.wdDoInit(InternalLoginPage.java:131)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:134)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:374)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:593)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
hi,
Change the cardinality to 1:1.This will solve your problem
Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you have not bound the model object to the model node.
You might refer to the code I have given to your earlier post.
<Service name> inp=new <Service name>();
wdContext.node<name>().bind(inp);
inp.set<attribute>(new <Struturename>());
or
inp.add<attribute>(new <Table>());
Hope this would solve your problem.
Kinldy close your earlier post also
Regards
Noufal
I think I am having the same problem with the blank input fields. When I try to set some default values in the fields, I get a nullpointer exception.
Then I tried mapping the controller context attributes directly into the view context (in the root). Now I get this exception message:
com.sap.tc.webdynpro.progmodel.context.ContextException: NodeInfo(CreateView): cannot modify Matnr because it is mapped and there is no active NodeElement to take the value
However, in the doInit of the custom controller I bind the model already:
// Create a new element in the node Z_Crm_Set_Matnr_Input
Z_Crm_Set_Matnr_Input inputSet = new Z_Crm_Set_Matnr_Input();
wdContext.nodeZ_Crm_Set_Matnr_Input().bind(inputSet);
This has always been sufficient before in previous web dynpros, but the difference is this. beforehand, it works when the function module imports were parameters, now it is a structure.
I tried Noufal's suggestion, but this line didn't work.
inputSet.setIs_Matnr(new Is_Matnr());
because it cannot be resolved or is not a type.
my controller context looks like this:
Z_Crm_Set_Matnr_Input
|
|-- Is_Matnr
| |--...
| |--...
|
|-- Output
Thanks for any suggestions.
regards,
faB
I usually create a Model Node in the View's context with the same name as the Model Node (cardinality 1:1) in the controller context and then create a Context Mapping between them.
Then in the wdDoInit() of the controller bind an instance of the model class to the context node.
After playing around with the code, I noticed that I do not need to set the parameters/structures/tables of the model node at all.
When, where and how is Matnr being modified in your case?
Hi Pascal,
I have used the same name, but I just havent copied the entire node, just the node and atrributes I will fill in before the FM is executed.
The data is being changed on the onPlugToThisView. I am copying data out of another table. This part is ok, I know because I tested by hardcoding a string value and still it crashed:
wdContext.currentIs_MatnrElement.setMatnr("123");
The strange this is that this does work:
wdContext.currentContextElement().setIp_Del(true);
the only different between the FM import field Ip_Del and Matnr is that Ip_Del is a "pure import parameter", but Matnr is contained in the structure Is_Matnr.
Thanks,
faB
Hi ,
You have mentioned that ...
" tried Noufal's suggestion, but this line didn't work.
inputSet.setIs_Matnr(new Is_Matnr());
because it cannot be resolved or is not a type."
In this case something else is wrong.If the node is available it should not give this error..check what is the problem in this case...
And also in the second case u r sayin
wdContext.currentIs_MatnrElement.setMatnr("123");
in this case i guess u are not creating any node but calling current element... so it wil throw an error..
use Is_Matnr a = new Is_Matnr();
a.setMatnr("123");
and then bind a to its parent structure....
Regards
Bharathwaj
Hi Bharathwaj,
Thanks for the input. Unfortunately, I cannot use the line (in the doInit of the custom controller):
Is_Matnr a = new Is_Matnr();
a.setMatnr("123");
eclipse won't render it. it is not a model class, Is_Matnr is merely a structure set as am import parameter in an R/3 function module.
I think the crucial different is that I CAN use Ip_Del because is an import parameter, but I cannot use Matnr because it is a field of the stucuture (for import) Is_Matnr.
I somehow need to add an element to the model-bound node "Is_Matnr" before i assign values to the attributes, but do not know how.
thanks for you help!
faB
Hi,
Is is_matnr there in the model node or not...?
If Is_Matnr is a structure u r passing from RFC.. then open the model classes of your model and check if their is a structure in that name.. if not then u have not put that structure in RFC properly ...
As far as i know u can create it and bind values even if its a structure....
Regards
Bharathwaj
Message was edited by: Bharathwaj R
yes, is_matnr belongs in the model class. You can also see how Ip_Del and Is_Matnr are different. (see below)
faB
/****************************************************************************
1:1 Relation -> Is_Matnr
***************************************************************************/
/** getter for ModelAttribute -> Is_Matnr
@return value of ModelAttribute Is_Matnr */
public com.sappi.sales.model.Zcrm_Matnr_Create_Upld getIs_Matnr() {
return (com.sappi.sales.model.Zcrm_Matnr_Create_Upld)getRelatedModelObject("Is_Matnr");
}
/** setter for 1:1 Relation Role -> Is_Matnr
@param value new value for 1:1 Relation Role Is_Matnr */
public void setIs_Matnr(com.sappi.sales.model.Zcrm_Matnr_Create_Upld value) {
setRelatedModelObject("Is_Matnr",value);
}
/* ***************************************************************************
ModelAttribute -> Ip_Del
**************************************************************************/
/** getter for ModelAttribute -> Ip_Del
@return value of ModelAttribute Ip_Del */
public boolean getIp_Del() {
return super.getAttributeValueAsBoolean("Ip_Del");
}
Hi,
I solved the problem by adding these two lines to the wdDoInit:
Zcrm_Matnr_Create_Upld inputCreate = new Zcrm_Matnr_Create_Upld();
wdContext.nodeIs_Matnr().bind(inputCreate);
However, now when I execute the RFC method. I get a nullpointer exception on the line:
wdContext.currentZ_Crm_Set_Matnr_InputElement().modelObject().execute();
Would some be able to tell me how to correctly do this? I know for tables it is simply .addTable() , but what about for structures like in this case?
Thanks again,
faB
ps. I have another thread open with the same problem. If you also answer there, I will be able to assign points...
If Z_Crm_Set_Matnr_Input is the toplevel model node, you must actually create and bind an instance for that. If your Zcrm_Matnr_Create_Upld() is a child node of that, you don't need to bind it anymore then. If it's not, you must apply the following rule:
<b>All</b> top-level context model nodes of the controller must be instantiated and bound in the controller's wdDoInit() method.
Hi,
First create the parent node element.
And then when u go throught the setter methods available u should be able too find one with
setIs_Matnr()... for this give the argument as inputCreate ..which is obtained from this line...
Zcrm_Matnr_Create_Upld inputCreate = new Zcrm_Matnr_Create_Upld();
Then excecute the same..
Regards
Bharathwaj
I found the setter, but still get the nullpointer.
This is what my wdDoInit looks like:
Thanks for your help and patience!!
Regards,
faB
// Create a new element in the node Z_Crm_Set_Matnr_Input
Z_Crm_Set_Matnr_Input inputSet = new Z_Crm_Set_Matnr_Input();
wdContext.nodeZ_Crm_Set_Matnr_Input().bind(inputSet);
//Create new element for child nodes of Z_Crm_Set_Matnr_Input
//RFC Structure Is_Matnr
Zcrm_Matnr_Create_Upld inputCreate = new Zcrm_Matnr_Create_Upld();
wdContext.nodeIs_Matnr().bind(inputCreate);
//RFC Table It_Matnr
Zcrm_Matnr_Display inputDisplay = new Zcrm_Matnr_Display();
wdContext.nodeIt_Matnr().bind(inputDisplay);
//add child nodes to parent Z_Crm_Set_Matnr_Input
inputSet.addIt_Matnr(inputDisplay);
inputSet.setIs_Matnr(inputCreate);
Hi,
I think there is some problem in the way you are adding the table..
The method to add a table is as follows.
Z<RFC > rf=new Z<RFC>();
wdContext.node<RFC>().bind(rf);
Now table
<Table> inp=new <TAble>();
rf.add<Table>(inp);
Now if structure is required
<Strucure> inp=new <Strucure>();
rf.set<Strucure>(inp);
If there is any further doubt you can check the article 'Linking RFC to WebDynpro' in the WebDynpro developers area
Regards
Noufal
Hi all,
This is working now. It was something as basic as invalidating a node before the execute, not after. I appreciate the help received from all of you.
I cannot assign points because this is not my post, but if you copy-paste your answers into this thread, I will...
Thanks again.
Cheers,
faB
Message was edited by: faB
hi all ,
It was a mistake.Sorry the answer was not intended for this question
Regards
Rohit
Message was edited by: Rohit Radhakrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Create an instance of the ModelClass
ModelClass xxx=new ModelClass();
2. IPrivate<ViewName>.I<ModelNode>Element e=wdContext.Create<ModelNode>Element(xxx);
3. WdContext.<ModelNode>().addElement(e);
This should work !!
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use wdContext.node<name>.addElement(wdContext.node<name>.create<nodename>element())...
And check if the error is coming..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.