cancel
Showing results for 
Search instead for 
Did you mean: 

Table

Former Member
0 Kudos

HI Experts....

I'm having a problem while updating data in table.........that is .....

im entering data in Form.....Having a button Called Add to Table........Form contains some field's whenever clcking that button i need to up date corresponding data.....one after other ........

on leadselection i have to display corresponding table content details....... 3rd view...all 3views embbeded in view container.......

Both form and table are in different views

My problem is how to Add the data/updating the table each time clicking Add button in first view....?

Regards ......

RAM

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

ya finally i got solution with your help

Thank you all

Ramprasad....

Former Member
0 Kudos

Hi Ramprasad,

Your problem is how to Add the data/updating the table each time clicking Add button in first view....?

1) Create Nodes/attributes for form and table at Controller level and map to all corresponding views.so all views have the following context structure.

let us Assume two nodes as below

NodeForm(node)

---name(attribute)

NodeTable(node)

-


name1(attribute)

2) In first view you have form with UI binded to NodeForm and a button. Then what u do is create View Container UI in first view and add second view(which has table UI binded with NodeTable) to the View Container. Such that u can see both the Form and Table at a time.

3) Under Button implementation write the following code

IPrivateExpView.ITableElement ele = wdContext.createTableElement();

ele.setName(wdContext.nodeForm().currentFormElement().getName());

wdContext.nodeTable().addElement(ele);

wdContext.nodeForm().invalidate();

So for every click on button the table UI is appended with Form data and the Form UI input field will be refreshed.

I had tried this it is working. Hope this will solve your requirements. Revert me if any queries or else close the thread.

Regards

Raghu

srinivas_sistu
Active Contributor
0 Kudos

Hi,

instead of declaring context attributes at view level, declare them at Component level and map the variables to all the view where ever necessary. So that now in form1 when you click Add to table button, set the values of context variables and fire a plug to view3.

in the onplugfrom method of view3, set the values of table with valus of form1 context(which are declared at component level)...

For more info on how to map context element between view and controller refer this thread...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/d5c09c90-0201...

Regards,

Srinivas

Former Member
0 Kudos

Hi,

for Add row to Table use this,

IEmpFormElement formElement = wdContext.currentFormElement();

IEmpTableNodeElement element = wdContext.nodeEmpTableNode().createEmpTableNodeElement();

element.setEmpName(formElement.getEmpName());

element.setEmpAge(formElement.getEmpAge());

element.setEmpRoll(formElement.getEmpRoll());

element.setEmpGrade(formElement.getEmpGrade());

wdContext.nodeEmpNode().addElement(element);

for Update a particular row,

IEmpFormElement formElement = wdContext.currentFormElement();

IEmpNodeElement element = wdContext.nodeEmpNode().getEmpNodeElementAt(wdContext.nodeEmpNode().getLeadSelection());

element.setEmpName(formElement.getEmpName());

element.setEmpAge(formElement.getEmpAge());

element.setEmpRoll(formElement.getEmpRoll());

element.setEmpGrade(formElement.getEmpGrade());

Regards,

ramesh

Former Member
0 Kudos

Hi,

write a code in ADD button like as follow.



for(int j=0;j<=wdContext.nodeTable_1().size();j++)
    {
    
    
	IPrivateAssi3View.ITable_1Element tabadd = wdContext.createTable_1Element();
 
		tabadd.setDept_ID(wdContext.currentTable_1Element().getDept_ID());
	    tabadd.setName(wdContext.currentTable_1Element().getName());
	     tabadd.setPSNO(wdContext.currentTable_1Element().getPSNO());
		wdContext.nodeTable_1().addElement(tabadd);

}

here nodeTable_1() is node which binds to the table and getDept_id,name and psno is value attribute of node.

hope it will help u.

Former Member
0 Kudos

Hi Ramprasad,

This attached step by step tutoraial is some thing to similar to your requirement.

From SDN tutorial , "Working with Web Dynpro tables" attached here.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90ac0015-d1c5-2a10-d788-aed89990...

Thanks

Krishna