Skip to Content
0
Former Member
Feb 28, 2007 at 11:34 AM

How to Fill a non Singleton Subnode with ABAP

17 Views

Hello Experts,

my Problem is to fill a non Singlton Subnode.

I have a Node called Subject with some Attribute plus a Subnode called Details

Details is a non Singleton node (Singletonbox is unselected).

The node Subject is filled with n Elements.

Then i try to fill the Subnode Details:

I get the number of Elements from Node Subject:

nodelength = node_subject->get_element_count( ).

then a move to the very first element:

node_subject->move_first( ).

then i do a loop

DO nodelength TIMES.

then i get the id of the selected element

node_subject->get_attribute ( EXPORTING name = 'ID' IMPORTING value = subjectid ).

then i search for the elements in a table

select * from detailstab into table tmpdetailstab where ID = subjectid.

the next step is, to bind the result table (possible n elements) to the node details

node_details->bind_table( NEW_ITEMS = tmpdetailstab SET_INITIAL_ELEMENTS = abap_false).

then i make a step to the next elements in subject

node_subject->move_next( ).

and the loop is at the end

ENDDO.

The code runs, butt the result is not equals to my forecast.

There is only a filled subnode Details in the first element of Subject. If i set the lead_selection for Subnode Details in the second element of Subject, i get the error "Invalid Index 1 when Setting the Lead Selection."

Have somebody an idea what's going wrong?

Stephan Borchert