cancel
Showing results for 
Search instead for 
Did you mean: 

Null pointer when clicking on a Table/Grid which has Lead Select Action

Former Member
0 Kudos

Hi All,

I have a WDJ project in which I'm using adaptive rfc method. The data from back end gets populated in to grid after an action. An action should be performed after clicking on Grid as it has action on Lead select.

This is the error which I'm getting .......

java.lang.NullPointerException

at com.sap.tc.webdynpro.progmodel.context.Paths.getNodeFor(Paths.java:409)

at com.sap.tc.webdynpro.clientserver.uielements.adaptbase.AbstractAdapter.updateLeadSelection(AbstractAdapter.java:693)

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter._changeLeadSelection(TableAdapter.java:11809)

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter.access$5800(TableAdapter.java:123)

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TableAdapter$Rows.onSAPTABLESELECTIONCELLCLICK(TableAdapter.java:8198)

... 49 more

Thanks.

Venkat.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In the class Paths, at line number 409; you are trying to access node which is not initialized.

Make sure before proceeding with lead selection; whether node has some elements

regards,

ganga

Former Member
0 Kudos

Hi,

Binding is Done and I'm checking the size of node before populating....

Thanks.

Venkat.

Former Member
0 Kudos

Hi,

All you are doing is correct :"checking the size of node before populating"

But in the event handling method of Paths class; before doing leadSelect

a) check whether node has some data

b) print that to confirm and do not do lead select

c) once you are sure that data is present for the node you are trying lead select

you can go ahead

regards,

ganga

Former Member
0 Kudos

Ganga,

I'm printing the size of the node and it is 1. This implies that we are getting data.

Thanks.

Venkat.

Former Member
0 Kudos

Hi,

Can you post the cardinality and selection of that node.

Regards,

Charan

Former Member
0 Kudos

Sree...

Cardinality is 0..1

Selection is 0..1

Thanks.

Venkat.

Former Member
0 Kudos

Hi,

For a node which is having cardinality 0..1 can have only one element at runtime. So it can hold only one record of data at runtime. So your table should show only record in the WebDynpro screen.

And what is the value of initializeLeadSelection property of your node. Is it true or false?.

If it is false then at runtime in the table shows the one record (in non selected mode). When the lead select action is invoked as initializeLeadSelection is false it throws null pointer error as no lead select is available. So change initializeLeadSelection property of your node to ture.

Regards,

Charan

Former Member
0 Kudos

Sree.....

It is already set to true...

Thanks.

Venkat.

Former Member
0 Kudos

Hi,

If it is already set to true:

At run time only one record will be displayed in the table (in selected mode). There is no chance of other record to exist in this node in non selected mode. So when is ur leadSelect action is invoking. There is no chance of leadSelect action. Becuase you will not be able to select any record. The one and only one existing record is already selected. Note: LeadSelect action will be executed only when you select a row in the table at runtime.

Regards,

Charan

Former Member
0 Kudos

Sree...

I'm getting confused .. Can you please give me work around to achieve this ...

Hope you got the requirement...

Thanks.

Venkat.

Former Member
0 Kudos

Hi Venkat,

As per my understanding...

1. You have a model node with cardinality 0..1

2. Data is populated into this model node (only one record can be populated as the cardinality is 0...1)

3. You have binded this node to table UI element.

4. You have binded one action to leadSelect action of table UI element

5. As the initializedLeadSelect property of model node is true, by default at runtime the one and only one record in the table will be displayed in the selected mode.

6. So where is the possiblity of selecting the another recode and invoking the leadSelect action?

So where are you getting the error exactly at runtime?

Please correct the above steps if my understanding is wrong.

Regards,

Charan

Former Member
0 Kudos

Sree,

I need to set the cardinality to 0..N

Thanks.

Venkat.

Former Member
0 Kudos

Hi,

I thought your model node is part of RFC context structure. If that is the case data will be populated from backend. So that is why i did not suggest you to change the cardinality.

Just for information : Did you create that model node Or it is part of backend RFC context structure?

Anyway good that your issue is resolved...:)

Regards,

Charan

Former Member
0 Kudos

Hi,

Did you bind the model node directly to the table UI element?

Regards,

Charan