cancel
Showing results for 
Search instead for 
Did you mean: 

Null Pointer Exception

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks for ur reply...

ReqDescriptionFields -->Valuenode

Req --> Model node

Please tel me

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks for ur reply...

I populate the bapi table......

Problem is getting data from bapi table...

the<b>Status</b> element type is in built-in type (255 char)

ie

element type -->built in char type (255 char)in bapi table

Is problem occured based on this?

Thanks & regards

Mathi

Former Member
0 Kudos

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. ?