cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.NullPointerException

Former Member
0 Kudos

Hi all,

java.lang.NullPointerException

at com.sap.sh.SHView.wdDoInit(SHView.java:101)

at com.sap.sh.wdp.InternalSHView.wdDoInit(InternalSHView.java:153)

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:445)

... 32 more

What i missing in this code...

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateSHView.IJobsElement.JOB);

<b>ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();</b>(101)

// Set field label and populate valueset

countryType.setFieldLabel("Country");

IModifiableSimpleValueSet valueSet = countryType.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < wdContext.nodeJobs_input().size(); i++)

{

valueSet.put(wdContext.nodeJobs_input().getJobs_inputElementAt(i),"cons"+i);

}

Plz Tel me

Thanks & Regards

Mathi

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Instead of

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateSHView.IJobsElement.JOB);

use

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("job");

and then try

Former Member
0 Kudos

Hi

thanks for ur reply..

Now its change line 102...that same error...

Thanks & regards

Mathi

Former Member
0 Kudos

Unfortunately, most of the given answers are plain wrong.

The problem is: You try to access an attribute named "job" (or a case-variation) of a node named "Jobs". (This follows from the existance of the constant IJobsElement.JOB).

But your code accesses an attribute "job" directly under the context root.

Thus you have to change the expression

wdContext.getNodeInfo().getAttribute(IPrivateSHView.IJobsElement.JOB);

into

wdContext.nodeJobs().getNodeInfo().getAttribute(IPrivateSHView.IJobsElement.JOB);

Armin

Former Member
0 Kudos
IWDAttributeInfo attributeInfo = wdContext.nodeJobs().getNodeInfo().getAttribute("job");
Former Member
0 Kudos

Finally a correct reply, but using the generated constant is even better.

Armin

Former Member
0 Kudos

Hi Mathi,

I am sorry i did not see your code properly.

Follow what Armin or Bharatwaj has said.

Former Member
0 Kudos

HI

Thanks for ypur reply..

I have changed ...but produce this type error...

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

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

at com.sap.sh.SHView.wdDoInit(SHView.java:102)

at com.sap.sh.wdp.InternalSHView.wdDoInit(InternalSHView.java:153)

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

See full exception chain for details.

Thanks & regards

Mathi

Former Member
0 Kudos

That's another error: If you want to assign a value set to the DDIC type of a context attribute that is mapped, you have to assign it to the <b>mapping origin</b>.

So just put the code into the controller where the original attribute lives.

Armin

Former Member
0 Kudos

Hi,

This problem occurs if you execute this in the view controller.

Execute the same code in the component controller you will not have error.

Create a method (say populate) in the component controller and write the code in that.

then add the component controller as the required controller to the view.

In the view controller inside the action (if the values are need after the action) or wdDoInit (if values are needed during loading of the view)

wdThis.wdGetComponentController.populate();

I hope this will solve your problem

Former Member
0 Kudos

after putting the code in the Controller populate method, I am still getting this error <<i>Parse method is not possible for this type</i>>

here is my populate method...


 public void Populate( )
  {
    //@@begin Populate()
	IWDAttributeInfo attInfo1 = wdContext.nodeSubmitElements().getNodeInfo().getAttribute(IPrivateDemurrageSubmit.ISubmitElementsElement.INVOICE_DOC);
		attInfo1.getModifiableSimpleType();
		IWDAttributeInfo attInfo2 = wdContext.nodeSubmitElements().getNodeInfo().getAttribute(IPrivateDemurrageSubmit.ISubmitElementsElement.SECOND_INVOICE_DOC);
		attInfo2.getModifiableSimpleType();	
    //@@end
  }

Former Member
0 Kudos

Hi,

It couldn´t find the attibute, therefore attributeInfo is null.

Can you try somethin like

wdContext.currentJobsElementElement.getAttribute(`JOB`)

Good luck, Roelof

Former Member
0 Kudos

Hi,

Please create element of your node called JobsElement first.

wdContext.nodeJobsElement.addElement(wdContext.nodeJobsElement.createElement);

in the wdIinit of your component controller and then again run and deploy it

Thanks and Regards

Avijit

Former Member
0 Kudos

Is there a node Jobs containing a value attribute "job".

Seems it cant find that attribute.. ! Check some spellin mistake.. !

Regards

Bharathwaj

PS :@ Satish : Thats incorrect. For accessing attribute info you just need the attribute.

Message was edited by:

Bharathwaj

former_member187990
Participant
0 Kudos

Hi Mathi,

The reason is you are trying to access a node which has no elements.

Check the nodes for elements before accessing it.