cancel
Showing results for 
Search instead for 
Did you mean: 

issues on webdynpro

Former Member
0 Kudos

Hi, all

1, I created the attribute ATTR1 under the NODE1 which the cardinality is 0...N.

2. I created the a TEXTVIEW element named TV1 and then bind it to ATTR1.

I did the step 3 respectively under the following steps.

3a. I ran the program. and an exception was raised, ' Access via 'NULL' object reference not possible. '

3b. I gave the ATTR1 some value by using the wizard in method WDDOINIT,

however, it also raised the same error ' Access via 'NULL' object reference not possible. '

and finally, I changed the cardinality from 0...n to 1...n. and then it got correct..

can somebody tell me why??

thanks in advance .

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

You have binded the Textview to a context attribute which is under a Node of cardinality 0..n, this is at the design time.

0..n means The node can hold records(Elements) ranging from 0 to n

1..n means the node canhold records(Elements) ranging from 1 to n

when you say 0..n there are no elements in the node by default.

when you say 1..n there is atleast one element in the node by default

So at runtime you are trying to show an Element's value in TEXTVIEW, but there is no element present as the cardinality is 0..n.

Abhi

Former Member
0 Kudos

HI,

thanks for your answer first.

but I still a bit confused, Actually I have already given the value to the ATTR1 at the RUN time, in accordance with step 3b.

so I think it should give the correct result,but it also was wrong.

Former Member
0 Kudos

Hi nicklc87

What Abhimanyu has explained is100% correct, theoratically. I will explian you what is happening in your case.

1st, you have set the cardinality of the node to 0..n so that means at run time there is no element (record) in your node.

However, you tried to save some value in the node. As there is no element (record), where can system store your

value. Hence, it raised the error.

2nd, when you set the cardinality to 1..n, by default system creates an empty element (record) in the node at run

time. And hence, the system has a place to store your value and it has worked.

Some more information for you, you can do this excercise using the cardinality 0..n. But in this case, before storing any

value to attribute, first you have to create an empty element in the node using a method CREATE ELEMENT of the node

instance.

Hope your confusion is very much cleared now.

Regards,

Vikrant

Former Member
0 Kudos

HI, Vikrant

Thanks very much... I understanded what u means... hahahahh

Former Member
0 Kudos

I really like the way you have tried to explain this concept of cardinality.

This is the best explanation that i have come across so far......

Keep it up Man....!

Happy Coding

Former Member
0 Kudos

Hi,Vikrant

I still encountered the same problem, but it's not as the same reason, because I used the CREATE ELEMENT before giving data to element(still used the cardinality 0...N).

but I don't know why it raised the same error msg. ' Access via 'NULL' object reference not possible. '

can explain to me in details agian ...like the way you explain to me..hahah

thanks in advance..

regards.

nick

Answers (1)

Answers (1)

Former Member
0 Kudos

hi ,

u may wish to see this online SAP help :

http://help.sap.com/saphelp_erp2005/helpdata/EN/7a/787e40417c6d1de10000000a1550b0/content.htm

Cardinality of a Context Node

When a node is created in the context of a Web Dynpro component, the cardinality of the node is specified. The cardinality defines how often a node is to be instantiated at runtime u2013 that is, how many elements of this node are available at runtime.

· 1u20261 Only one element is instantiated.

· 0u20261 At runtime, no more than one element is instantiated, but it is also possible that no element is instantiated.

· 1u2026n n elements can be instantiated, but at least one element must be instantiated.

· 0u2026n The number of instantiated elements of the context node can vary.

I hope u have got it

regards,

amit