cancel
Showing results for 
Search instead for 
Did you mean: 

Node inside Node

Former Member
0 Kudos

Hi,

I am facing a problem in getting and setting the node from webservice node. I have two nodes of the following structure.

<i>MainNode</i> (Model node)

-


<i>SubNode</i> (Model node under MainNode)

-


<i>ItemNo</i> (Attribute under SubNode)

-


<i>lotNo</i> (Attribute under MainNode)

-


<i>quantity </i> (Attribute under MainNode)

Now I have a table which has 3 columns. 2 are lotNo and quantity whose values are retrieved from MainNode. The third column is a button on click of which I get a popup displaying a table of ItemNo from SubNode. For each lotNO, I should get different sets of ItemNo values. I am confused on how to get values for ItemNo. Whichever row's ItemNo button I click on, I get same set of ItemNo for different lotNo also. Kindly guide me the correct way to get the ItemNo from the structure above ( How to set vaues from node inside node).

Regards,

Harini S

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Harini,

You can get an idea by looking this tutorial:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/applicat...

Regards

Abhimanyu L

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

We worked with workaround with having the variables directlt under main node instead of having them inside another node.

Former Member
0 Kudos

hi harini!!

make the singleton property as false first and then try. i think i have a solution to ur problem, could you please explain the complete scenario once more. as per what node contains wat field?? 'coz i was facing a similar problem earlier, but got the proper solution. please explain the scenario.

Regards,

Gita

Former Member
0 Kudos

Hi Harini,

If you are using NW04S or NW04 >=SP13 , you can set the Table property "CompatibilityMode" to "NW04Plus", which will solve your problem.

Go through this tutorial to get more info

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c092333b-0601-0010-e7af-8c227fb6...

regards,

Shweta

Former Member
0 Kudos

Hai Harini,

u dont need child element, if leadsection was set then automatically child SubNode leadselection also changes.

wdcontext.nodeMainNode().setLeadSelection(row);

// row is an integer value, which represent the on which row( or node element) selected in the MainNode

int size=wdcontext.nodeSubNode().size;

for(int i=0;i<size;i++){

retrieve all the ItemNo here

// String itemNo=wdcontext.nodeSubNode().getSubNodeElementAt(i).getItemNo()

// like this u will the different ItemNos

}

Regards

Siva Sankar N

Former Member
0 Kudos

Hi,

Both the nodes are model nodes with singleton = true. So I can't get the result as u all suggest. Kindly let me know some other solution.

Regards,

Harini S

Former Member
0 Kudos

Hai Harini,

To get the diffirent ItemNos on clicking on the different button of the different row, set the leadselection of the MainNode to the row in which button was selected then u will get the ItemNos of that SubNode.

u said that u r getting the Same ItemNos by clicking on the button of the different row, this happens because of the leadselection of the MainNode, leadselection remains same( Zero ) when u r retrieving ItemNos, that y u r receiving ItemNOs of the first MainNode node

Regards

Siva Sankar N

Former Member
0 Kudos

Hi siva,

Lead Selection is fine. But how do I get the child element? Can u send some sample piece of working code? That would be greatly helpful. Thanks.

Regards,

Harini S

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Harini,

Instead of taking the third column take only two columns and

after selecting any row navigate to the view in which you want to show

the child details.

for filling the Node_Item, you have to use Supply function property of the node.

where you have to provide a function name which fills the child node data.

Regards

Abhimanyu L

Former Member
0 Kudos

Hi,

When the web service model has executed, I'll get all the values of the nodes. Now I've to access and get the values from the nodes. How do I loop from the values in the MainNode and SubNode to find out that a particular vaue of a subnode element belongs to the MainNode?

Regards,

Harini S

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Harini,

Get the Main Node Element from the Lead Selection

int i = wdContext.nodeHeader().getLeadSelection();

headerElement = wdContext.nodeHeader().getElementAt(i);

int size = mainNodeElement.node<childNode>.size();

for( i=0; i<size; i++)

childnodeElement = mainNodeElement.node<childNode>.getElementAt(i);

and retrieve values from the childnodeElement.

Regards

Abhimanyu L

Former Member
0 Kudos

Hi Abhimanyu,

I am not able to get the node<childNode> itself from the parent element.

<b>mainNodeElement.node<childNode>.getElementAt(i);</b>

Kindly help me.

Regards,

Harini S

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Harini

check the singleton property of the child node if it is true then you cannot

see that method, cause you have only one instance of that node.

if it is false you have only one instance of item level node, you can get it

directly using

wdContext.current<ChildNode>.getAttributes();

Regards

Abhimanyu L