cancel
Showing results for 
Search instead for 
Did you mean: 

runtime error for ui element multipane

Former Member
0 Kudos

hello.

i have a question.

i implemented uielement multipane example in wda.

it worked very well in only first trying, but it occured a runtime error -that is Access via 'NULL' object reference not possible.- from second trying.

context -


hd <node>

-


attribute1 <hd of attribute>

-


attribute2 <hd of attribute>

-


item <hd of subnode>

-


attribute1 <item of attribute>

-


attribute2 <item of attribute>

below is source.

==========================================================

DATA: node_hd type ref to if_wd_context_node,

node_item type ref to if_wd_context_node,

itab_hd type wd_this->elements_hd,

stru_hd type wd_this->element_hd,

itab_item type wd_this->elements_item,

rt_auart type ref to data,

rt_vbeln type ref to data.

field-symbols: <fs_auart> type table,

<fs_vbeln> type table.

  • retrieve the data from the select option

rt_auart = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'AUART' ).

  • assign it to a field symbol

assign rt_auart->* to <fs_auart>.

  • retrieve the data from the select option

rt_vbeln = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'VBELN' ).

  • assign it to a field symbol

assign rt_vbeln->* to <fs_vbeln>.

  • retrieve that data from the database.

  • Normally it is suggested to encapsulate the data retrieval in a separate class.

  • For simplicity, the select statement has been implemented here.

select * into corresponding fields of table itab_hd

from vbak

where vbeln in <fs_vbeln>

and auart in <fs_auart>.

  • bind the data to the context

node_hd = wd_context->get_child_node( name = 'HD' ).

node_hd->bind_table( itab_hd ).

  • bind the data to the context

loop at itab_hd into stru_hd.

  • retrieve item_node object each sy-tabix

  • i could't get item_node object when sy-tabix is 1.

  • i hope to know why i can't get item_node object when sy-tabix is 1.

node_hd->get_child_node(

exporting

index = sy-tabix

name = 'ITEM'

receiving

child_node = node_item ).

***************************************************************************

  • when index = 1

  • node_item object is null.

*

  • why node_item object is null?????

  • i don't got it.

  • can sombody explain about it???

  • because of this matter, i can't acess frist node_item to insert value.

  • do you have a solving this matter?

*

***************************************************************************

select * into corresponding fields of table itab_item

from vbap

where vbeln = stru_hd-vbeln.

node_item->bind_table( itab_item ).

endloop.

Accepted Solutions (0)

Answers (5)

Answers (5)

laurent_chavanis
Explorer
0 Kudos

Hello,

I just fall in a similar issue and I did not take care of the sy-tabix. Indeed, it was starting at 0, while WD indexes are starting at 1. Thus it was returning 'NULL' sub-nodes.

I fixed it using a local Integer variable for get_child_node index, starting at 1 and incremented in the loop.

Hope this helps,

Laurent

Former Member
0 Kudos

i have solved the problem.

it is to use a supply function.

is another solution impossible?

Former Member
0 Kudos

it work very well exception of below case.

when excution is over second trying and sy-tabix is '1'.

that is, hd_node of binding table have value set and i access to item_node of index '1' .

it is not a matter of cardinality or singleton.

former_member215843
Active Participant
0 Kudos

Hi,

I am afraid that you have to debug this error. Enable system debugging, and try.

Perhaps you have removed the "item" subnode or there is a problem with the mapping?

Ciao Regina

Former Member
0 Kudos

Hi again.

I just found out, that my statement (error description) in the above thread is wrong. Surely it works and it does not depend on the cardinality.

So forget my question Regina.

Cheers

Former Member
0 Kudos

item <hd of subnode> is not a singleton.

<hd of subnode> cardinality 0:n

<item of subnode> cardinality 1:n

i think that this is not a reason of cardinality or singleton.

because it worked very well first.

but it doesn't work from second excution.

Message was edited by:

jg lee

former_member215843
Active Participant
0 Kudos

Please check whether <item of subnode> is a singleton, and make sure it is NOT a singleton.

Former Member
0 Kudos

Hi JG.

I guess ur item subnode has cardinality 0..n. In this case trhe subnode is not

initially created. You can solve this by setting cardinality to 1..n. Then you will

always have one empty element in the subnode and the subnode gets created.

Another solution would be to create a supply method for the subnode item.

Then you can get the info you need from the parent element and select the data

and bind the result table to the node.

Cheers,

Sascha

former_member215843
Active Participant
0 Kudos

Hi JG, hi Sascha,

The creation of the subnode is independent of the the cardinality of the subnode, but only depends on the elements of the parent node (node_hd) and whether the subnode is declared as singleton or not.

If the subnode is declared as <b>singleton</b>, it is only created for the lead-selection-element. Otherwise it is created for all elements.

So change the subnode to be not a singleton, and it should work.

Ciao, Regina

Former Member
0 Kudos

Hi Regina.

So you say if it is not declared as singleton it is created for each element. But

when I declare my subnode with cardinality 0..1 I face the same problem.

This is what I do:

I bind the elements to the parent node. Afterwards I loop all elements of the parent

node and try to get the subnode with element->get_child_node( ). If cardinality of

the sub node is 0..1 or 0..n the reference is NULL. If cardinality is 1..1 or 1..n the

reference is not initial.

At what step does the frameowrk create the subnode then?

Cheers,

Sascha