cancel
Showing results for 
Search instead for 
Did you mean: 

Create Dynamic Table

Former Member
0 Kudos
217

Hi Everybody,

I am trying to create tables as dynamic table. Is their any documentation for Dynamic creation for table. If u have please send it to me.

Regards

Krish.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Plz looking at this sample and hopefully it useful for u.

https://wiki.sdn.sap.com/wiki/display/Snippets/CreateDynamicTable

Brgds,

NNP

Former Member
0 Kudos

Hi

Go through the following ..<a href="/people/sap.user72/blog/2005/05/09/have-you-played-blindfold-chess table UI</a>

And see the code provided by Armin in the comments to the weblog...you ll find it really useful

P.S:Award points if helful

Former Member
0 Kudos

Hi,

Go through this link

also go through this link:

http://help.sap.com/saphelp_nw04/helpdata/en/4f/07cf3dd28b5610e10000000a114084/frameset.htm

Regards,

Rajeev

Message was edited by: Rajeev Ranjan

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi selvam,

see this thread:

Regards

Suresh KB

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Selvam,

public static void wdDoModifyView(IPrivateDynamicView wdThis, IPrivateDynamicView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(firstTime)

{

//1. Create Node: TableNode statically

//IWDNodeInfo nodeInfo = wdContext.getNodeInfo().addChild("TableNode",null,true,true,false,false,false,true,null,null,null);

//2. Add Attribute: Put in a loop (int i) to create 'n' attributes.

for(int i=0;i<3;i++)

{

IWDAttributeInfo attInfo = wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).getNodeInfo().addAttribute("name"+i,"ddic:com.sap.dictionary.string");

}

// 3. Create Table:

table = (IWDTable)view.createElement(IWDTable.class,"ID");

String[] colHead = {"Master ","Business","Business1"} ;

int count = 0;

IWDTableColumn nameColumn = null;

for (int j = 0; j < 3; j++) {

//4. Create CellEditor (TextView):

//5. Bind attribute to the TextView:

//6. Create Column:

nameColumn = (IWDTableColumn) view.createElement(IWDTableColumn.class, "column"+j);

IWDCaption colHeader = (IWDCaption)view.createElement(IWDCaption.class,"header"+j);

IWDTextView textView = (IWDTextView)view.createElement(IWDTextView.class , "text"+j);

colHeader.setText(colHead[j]);

nameColumn.setHeader(colHeader);

textView.setText("");

textView.bindText(wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("name"+j));

//7. Set CellEditor of Column:

nameColumn.setTableCellEditor((IWDTextView)textView);

//8. Add the Column to the Table:

table.addColumn(nameColumn);

}

IWDTransparentContainer con = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

con.addChild(table);

wdThis.DisplayRecords();

}

//@@end

}

public void DisplayRecords( )

{

//@@begin DisplayRecords()

List records = new ArrayList();

ArrayList recordsArray = new ArrayList();

for(int kk = 0;kk<5;kk++)

{

recordsArray = new ArrayList();

recordsArray.add("Suresh"+kk);

recordsArray.add("Nakul"+kk);

recordsArray.add("Sasi"+kk);

records.add(recordsArray);

}

IWDNodeElement dynEle = null;

ArrayList currentRow=null;

String resultData = "";

int k = 0;

k=records.size();

int h = 0;

while(h<k)

{

currentRow =(ArrayList)records.get(h);

manager.reportSuccess("currentRow"+ currentRow);

dynEle = wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).createElement();

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

resultData = currentRow.get(i).toString();

dynEle.setAttributeValue("name"+i,resultData);

}

wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).addElement(dynEle);

h++;

}

table.bindDataSource(wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).getNodeInfo());

//@@end

}

Regards

Suresh KB

Former Member
0 Kudos

Hi Suresh,

I have gone through your code create dynamic table. Here we have the same type of requirement. Here is the requirement we have

We already have a table with the list of records, and all those records are displaying in textview. When I select a particular row the UI elements has to change from textview to inputfields and drodownlists for the particular row. Is there any code related to this type of requirement.

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi,

Unfortunately I dont have sample code for scenario which you looking for but you can do work around this code.

Regards, Suresh KB

0 Kudos

Hi Suresh,

Thanks for the code. It really helped a lot.

Thanks and Regards,

Ravindranath

0 Kudos

Thanks for the sample.

It's really helpful.

Regards,

Steven Nguyen