cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Master Column and TreeByNesting

Former Member
0 Kudos

Hello @ all,

I am programming a webTool which should displayd data in a structure.

For this I have context like this:

Customer

SID

Responsibility

ServiceMgr

AccountMgr

and it should be display in a table like this (e. g.):

_______________________________________________

| System || Responsibility || ServiceMgr || AccountMgr |

Microsoft

+12345 William T. Tom F. Ralf C.

+45628 Martin J. Tom F. John K.

SAP

+87956 ... ... ...

I hope for help.

Thanks all

Marcus

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You need to create a recursive context structure to use treeByNesting.

Pl go through the following tutorial to under stand its use better

Creating a Tree Structure in a Table

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94a...

Regards

Ayyapparaj

Former Member
0 Kudos

Hello,

I know this tutorial. I did it so far.

But my problem is how to code the table structure when I have my contexts like I wrote before.

I think I need to create a Context with one ValueNode, RecursionNode, My whole contexts and other contexts (ChildrenLoaded, Expanded, IsLeaf)

Something more?

What is my further task?

Former Member
0 Kudos

Hi,

Your context Structure Should be as follows

Customers--->Node

Childrens--->RecursiveNode Based on Customers

Customer -->Attributes

SID

Responsibility

ServiceMgr

AccountMgr

ChildrenLoaded boolean

Expanded boolean

IsLeaf boolean

Map the respective attributes to the properties of table and tree by nesting.

Then populate the context wit some values as follows



Sample code

for(int x=0;x<2; x++)
	  {
		  IRootElement nodeElement = wdContext.nodeCustomers().createCustomersElement();
		  nodeElement.setSID(value);
		  wdContext.nodeCustomers().addElement(nodeElement);
		  
		  // adding childrens
		  IRootElement nodeElementChild = nodeElement.node().createRootElement();
		  nodeElementChild.setSID(value);
		  nodeElement.node().addElement(nodeElementChild);
	  }


Regards

Ayyapparaj

Former Member
0 Kudos

I can't follow you very good.

I'm not such a good Java-Expert.

I don't know the right prozedure and how / where to insert the right code-rows.

I hope you can help me on a easy way and step by step.

Thank you.

Former Member
0 Kudos

So far I have created the context like you said.

Next I have create a Table (RootUIElementContainer > Apply Template) with the attributes "Responsibility", "ServiceMgr", "AccountMgr".

Then insert a MasterColumn and did the following:

childrenLoaded > Customers.ChildenLoaded

expanded > Customers.Expanded

isLeaf > Customers.IsLeaf

what should I do at next?

Regards

Marcus

Former Member
0 Kudos

Hi,

use the above code in the wdDoInit of your controller and see that the data is getting populated to your table.

regards

Ayyapparaj

Former Member
0 Kudos

I did it, but there are a few problems in the code.

IRootElement cannot be resolved or is not a type.

how can i resolve this problem?

Thank you so far

Former Member
0 Kudos

Hi,

Change IRootElement to that of yours

Example based on my previous post ICustomersElement

Regards

Ayyapparaj

Former Member
0 Kudos

Shure, that I have to do this in the Implementaion Tab of the Controller or of the View?

What about the Methods and Action. In the project "TutWD_TreeByNestingTableColumn" they're build before. What should I do?

Maybe you can give me the whole code to create the Master Column for my project?

I don't know where and how I have to implement...

Thank you

Regards

Marcus

Former Member
0 Kudos

Maybe it is easier for you to start with a flat table. Later you can try to use a hierarchical structure.

Context:

Rows (node, cardinality=0:N, supply function=supplyRows)

- Customer (string)

- SID (string)

- Responsibility (string)

- ServiceMgr (string)

- AccountMgr (string)

CustomerTable (Table)

CustomerTable.dataSource = Rows

Use table wizard to create table columns (use TextView as cell editors).

For testing, implement the supply function like


void supplyRows(...node...)
{
  String[][] data = {
    {"customer#1", "sid#1", "resp#1", "serviceMgr#1", "accountMgr#1"},
    {"customer#2", "sid#2", "resp#2", "serviceMgr#2", "accountMgr#2"},
    etc.
  };
  for (int i = 0; i < data.length. ++i)
  {
    IRowsElement row = node.createAndAddRowsElement();
    row.setCustomer(data<i>);
    etc.
  }
}

Then you should see a table with the test data on the screen. In the next step, supply your real data from whatever backend model.

If this works, you can try to use a row grouping to avoid repeating the customer name for consecutive rows with the same customer. This is almost a hierachical representation.

If this all works, we can continue with your original requirement.

Armin

Former Member
0 Kudos

Hello again,

I've already the same problem. I create two view. one for writing testdata in the contexts and one with the Table (with MasterColumn).

In the first view my context is the follows:

Acc Attribute

Cust Attribute

ID Attribute

Res Attribute

Ser Attribute

for the second view (with the Table):

Customers Node

Childrens RecursionNode

AccountMgr Attribute

ChildrenLoaded Attribute

Customer Attribute

Expanded Attribute

IsLeaf Attribute

Responsibility Attribute

ServiceMgr Attribute

SID Attribute

and for the Component Controller:

Customers Node

Childrens RecursionNode

AccountMgr Attribute

ChildrenLoaded Attribute

Customer Attribute

IsLeaf Attribute

Responsibility Attribute

ServiceMgr Attribute

SID Attribute

when I try to deploy the App this Message will displayd:

("Abfrage" is the first View)

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(Abfrage): cannot modify Cust because it is mapped and there is no active NodeElement to take the value

Maybe my Implementation-code is wrong.

Maybe I can get in contact to someone for e-Mailing my Project, because I don't know where the code should be edit,....

Thanks for help

Best Regards