on 07-19-2007 9:16 AM
Hi <b>Friends,</b>
I am getting <b>NullPointerException</b> while the Data was retrieved from DataBase to Change Mode. But the Data Which was given in the Edit Mode successfully stored in the DataBase......
The Code which was I used in above Process Given Below:
<b>wdContext.currentReqDescriptionFieldsElement().setPos
(wdContext.currentReqElement().getStatus());</b>
Please Advice Me....
Thanks & regards
MAthi
HI Mathi,
Tell me ReqDescriptionFields & Req are model node or value node?
If ReqDescriptionFields is valuenode, then create elemnts to this node by
IPrivate<View>.IReqDescriptionFieldsElement rEl=wdContext.nodeReqDescriptionFields().createReqDescriptionFieldsElement();
wdContext.nodeReqDescriptionFields().addElement(rEl);
rEl.setPos(wdContext.currentReqElement().getStatus());
Regards
Fahad hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then, it looks like the exception is because value node (ReqDescriptionFields)
dont have any values.
If this node is supposed to have only one value, then make the cardinality of ReqDescriptionFields as 1..1. Then set the value by the code u had used initially.
If not, use this code
IPrivate<View>.IReqDescriptionFieldsElement rEl=wdContext.nodeReqDescriptionFields().createReqDescriptionFieldsElement();
wdContext.nodeReqDescriptionFields().addElement(rEl);
rEl.setPos(wdContext.currentReqElement().getStatus());
Here, I am assuming that there is no problem with model node.
Check whether value is there in model node also, by printing it's size (wdContext.nodeReq().size())
Regards
Fahad hamsa
Thanks for ur reply...
I tel my full requirement....
Actually setPos() is the dropdown this value stored in dictionary as a string
I pass the value to bapi from drop down and this value stored successfully...
But i am not able to retrived the same data from bapi(getStatus())..
If i try to get the data, short dump and the error is occurred in the code... (Null pointer exception)
Please Tel me ....What is the error and how to rectify this...
Thanks & regards
Mathi
Hi Mathi,
Hope you are invalidating your output node after the execution of the BAPI and there should be one response node inside your req(model node).
wdContext.nodeResponse().invalidate();
If you are adding this to table (binded to a value node) then add it like this.
IPrivate<viewname>.I<valudenode>Element ele = wdContext.node<valuenode>().create<valuenode>Element();
ele.set<attributename>(WdContext.nodeResponse().currentResponseElement().get<attributename>());
wdContext.node<valuenode>().addElement(ele);
Hope this helps you.
Regards,
Murtuza
Hi Mathi,
there can be two reasons for getting the Null Pointer Exception in Your case.
1. Either the input binding is missing in " wdDoInit()" of the Component controller or custom controller which ever you are using.
for eg.
Bapi_Po_Getdetail_Input input1 = new Bapi_Po_Getdetail_Input();
wdContext.nodeBapiPoGetdetail().bind(input1);
input1.setPurchaseorder(i.toString());
2. Either the item you are searching is not available, and you are tring to retreive it from the controller. for this you have to check for the size of parent node when the modle is executed.
Message was edited by:
Armin Reichert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if the type in the bapi is CHAR then u can use STRING as ur type in the context nodes.
But STRING type is not recognized by ABAP, so u may need to type cast.... or it wont retrieve data.
are you also giving some parameters to the bapi to get the result...i.e. some search string or smthing similar. ?
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.