cancel
Showing results for 
Search instead for 
Did you mean: 

How to display composite Business Objects' data in 1 table?

Former Member
0 Kudos

Hi,

I have an issue wherein i am supposed to display data from 2 nodes (parent and child) in a Web Dynpro table.

The approach i followed was to form a new node and then bind my output tablr to this node.

But now, how do i populate this node with data from another 2 nodes whoch have a parent child relationship.

i am able to display data of parent but not of child as i have no clue how to access "nodekey".

Any help will be highly appreciated.

Regards,

Devashish.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Devashish,

To display the data from both parent & child nodes, just do the following :

1) Make sure that the child node is non-singleton, has cardinality 1..1.

2) Use either supply function to populate the child node or populate it manually after the parent node has been populated. If you need more help on supply function refer http://help.sap.com/saphelp_nw04/helpdata/en/d6/078aa26b73fb47b43d9330f1a207cf/content.htm

3) Create a table UI element (not by using the template, but by insert child->table). Add as many columns as you require and manually bind these column's UI element to the required attribute (they can be in the parent or child node).

Now, the table will show data from both the nodes.

This thread may help you in this regard

Hope this helps,

Best regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

Following your 2nd approach, i read the documentation but am unable to get what "SomeBOL" means in the implementation code.

Regards,

Devashish

Former Member
0 Kudos

Hi Devashish,

'SomeBOL' is some object being used in that example to retrieve the order data.

Your supply function will have two parameters - 'node' and 'parentElement'. node is the child node and parentElement is the current element of the parent node.

So you can set the value for your child node as

public void <supply_function_name>(IPrivate<View>.I<child_Node> node, IPrivate<View>.I<parent_node>Element parentElement)

{

IPrivate<View>.I<child_node>Element elmt = wdContext.create<child_node>Element();

elmt.set<attribute>(<value>);

node.addElement(elmt);

}

Devashish, I couldn't understand your statement 'Following your 2nd approach' ; you need to do all those three steps to display the data.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hi,

I am unable to understand the supply function.

See i changed the cardinality.

Then, i have to use supply function as i want to have a link between parent and child nodes. The link to a thread shows how to attach n attributes dynamically. but there is no relation between the nodes.

And the code mentioned in supply func is confusing me.

The code is using SomeBOL to get all the child nodes for a parent. I want exactly that as that SomeBOL is nothing but the key to traverse to child node!

i am unable to figure it out..

Please correct my view...

Regards,

Dev

Former Member
0 Kudos

Hi Dev,

Supply function is simply used to just populate the child nodes. Please don't get confused with 'SomeBOL' as it is a data object used in that particular example. Please ignore that statement. In your case, write the supply function as given in my previous post.

In that example the node is having cardinality 0..n as a customer can have 0 to n orders. And 'SomeBOl' has all the orders for a customer. So they are iterating through SomeBOL and creates that much elements for the "order" node. Please note that the particular example only deals with using supply function, but not with showing the child node data in a table.

But in your case, even if your cardinality of the child node as 0..n and create n elements, <b>only the first child node element's attributes will be shown in the table</b>. That's why I asked you to set cardinality to 1..1. So each parent node can have only one child node element. Hence you don't need to iterate through a loop and create more than one child element. (As far as I know, even if you create multiple child elements only the first one will be shown in the table).

Hope this helps,

Best Regards,

Nibu.

Message was edited by: Nibu Wilson