cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Tree inside table from BAPI

Former Member
0 Kudos

Hi,

My BAPI returns me a table and I need to display this table in a tree structure.

How will I goahead with this? I saw the sample application in sdn but its with static data(article categories,groups and entries). But here I have to get the data from backend Bapi and display in a tree structure. I already have model nodes in my view context. Do I have to create separate "recursive node" of type <IMymodelnode>

Thanks

Kukku

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Kukku,

For creating tree inside table, u need atleast 1 recursive node. if u don't have that in ur model node, u need to create value node & recursive node in that value node.

regards

Sumit

Former Member
0 Kudos

Hi

I have to create a tree inside table from BAPI which is returning me a table with several attributes.

In the init() of my treeview I have the following code:

public void wdDoInit()

{

//@@begin wdDoInit()

//addOutput_Res(wdContext.nodeOutput_Res(),"ROOT");

wdThis

.wdGetDISTitleCreateAndMaintainController()

.Z_Mmweb_Material_Attribute_Input("DIS", wdContext.currentZ_Mmweb_Title_Search_InputElement().getDiscottl());

int tblSize2 = wdContext.nodeAttribute_View_Out().size();

wdComponentAPI.getMessageManager().reportWarning("tblSize2"+tblSize2);

Collection myRecords = new ArrayList();

myRecords.clear();

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

String strEan11 = "";

String strEwbez = "";

String strExtwg = "";

strEan11 =

wdContext

.nodeOutput_Res()

.nodeAttribute_View_Out()

.getAttribute_View_OutElementAt(i)

.getEan11();

strEwbez =

wdContext

.nodeOutput_Res()

.nodeAttribute_View_Out()

.getAttribute_View_OutElementAt(i)

.getEwbez();

strExtwg =

wdContext

.nodeOutput_Res()

.nodeAttribute_View_Out()

.getAttribute_View_OutElementAt(i)

.getExtwg();

IPrivateTitleMaintenanceView.IDummyAttributeNodeElement element =

wdContext.createDummyAttributeNodeElement();

// asssign here

element.setEan11(strEan11);

element.setEwbez(strEwbez);

element.setExtwg(strExtwg);

myRecords.add(element);

}

wdContext.nodeDummyAttributeNode().bind(myRecords);

//

//@@end

}

When I run this its giving me " com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TitleMaintenanceView.Z_Mmweb_Material_Attribute_Input.Output_Res.DummyAttributeNode): cannot bind or add elements because the node has no valid parent "

Please tell me where I went wrong?

Thanks

Kukku

Former Member
0 Kudos

Hi Experts,

Please response for this thread.

I have to do the same scenario.But I am unable to proceed.Please gives steps.Its really urgent.

Regards

Nutan

Former Member
0 Kudos

Hi Kukku

Can you please tell me how have you proceeded with that scenario. What are the context fields have you added?

As per my knowledge to fetch data by using BAPI we have to create a Model and get the Bapi there.Have you done in the same format?

Your Bapi should give an parent id so that tree structure can read it.As I tried with the static tree structure I found that to display the Bapi output in a tree.It requires the Parent id.So,in Bapi it should have a parent id field which will help the tree to check whether the data is a root element or not.Then only the tree can read the values and load the children for that ROOT node.

I think this iunformation can help you.Please tell me how you have proceeded.I am also working in the same scenario.I need urgent help.

Regards,

Nutan

Former Member
0 Kudos

Hi Kukku,

"Node(TitleMaintenanceView.Z_Mmweb_Material_Attribute_Input.Output_Res.DummyAttributeNode): cannot bind or add elements because the node has no valid parent " . this error means u r trying to use a child node, without creating the instance of ur parent node.

what exactly is ur node structure ??

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

I am also working in the same scenario but unable to understand how to define the tree structure.In static tree creation in a table an array is created in a java class and that was binded or read by the tree structure.I am not having any idea about it.If you have done with this scenario then can you help me how to proceed in this?

Can you please provide step by step solution?

Regards,

Nutan

Former Member
0 Kudos

HI Nutan,

As i told earlier, if u r clear with recursive node concept, u will not get any problem in creating the structure u want. Just go thru this

http://help.sap.com/saphelp_nw70/helpdata/en/5d/97384162316532e10000000a1550b0/frameset.htm

http://help.sap.com/saphelp_nw70/helpdata/en/13/4cde139306304480e89d815ffcf891/frameset.htm

What exactly r u not able to understand? here instead of java class , u will be getting data from the rfc & put that data in context.

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

In Calling Bapi and displaying the output we use to create a model and that model node is binded with the context of the component controller.And in tree structure are having our own strucutre.So that means I have to create all those attributes in controller.

I need a sructure like:

Methodology

|

__Phase

__workpackage

__Activity

|__Task

This structure should be in the table with the checkbox fields.Please help to create the structure in context field.

My Bapi gives the output as

Nodeid , NodeType , NOdeName , ParentId , Person

So can you please tell me what to give in component controller context.

Regards

Nutan