cancel
Showing results for 
Search instead for 
Did you mean: 

Copy and Paste functionality required in Webdynpro Java

Former Member
0 Kudos

Hi All !!

I want to create a functionality in which i can copy the contents from table (Created in Webdynpro Java) and paste them below in same table.

Scenario:

I've a table UI (Created in Webdynpro Java) in my screen. Table UI is displaying data from database.

Modifications, Insertion and deletion of data are allowed in the table control which will in turn reflect to Database.

Now i want users to copy and paste the rows in the Table UI and past it in same table

Is it possible or not ?

Can any one help me in this regard?

Regards,

Abhijeet

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Create two buttons for copy and paste

In the copy button

Try to store the lead selections of the selected elements

In the paste button

Paste back the data which exists in the lead selection by

making use of create element on the node that is bound to the table.

Regards

Ayyapparaj

former_member751941
Active Contributor
0 Kudos

Hi Abhijeet,

try this.

Assuming Value node Customer with attribute cname, cno and sal is bound to the table.

//creating Dynamic node inside wdDoInit method for copy the table row details.

IWDNodeInfo nodeInfo = wdContext.getNodeInfo().addChild("DynamicCustNode", null,true, false, false, false, false,

true, null, null, null);

nodeInfo.addAttribute("custName", "com.sap.dictionary.string");

nodeInfo.addAttribute("custNo", "com.sap.dictionary.string");

nodeInfo.addAttribute("custSal", "com.sap.dictionary.double");

IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("DynamicCustNode", IWDNode.LEAD_SELECTION);

node.addElement(node.createElement());

Inside View take a Button Say Copy,inside the action of the button store the selected table row data in the created dynamic node and copy

the dynamic node details in to your Value node that is bound to the table.

int leadSelected = wdContext.nodeCustomer().getLeadSelection();

int n = wdContext.nodeCustomer().size();

IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("DynamicCustNode", IWDNode.LEAD_SELECTION);

node.getCurrentElement().setAttributeValue("custName", wdContext.nodeCustomer().getCustomerElementAt(leadSelected).getCname());

node.getCurrentElement().setAttributeValue("custNo", wdContext.nodeCustomer().getCustomerElementAt(leadSelected).getCno());

node.getCurrentElement().setAttributeValue("custSal",new Double(wdContext.nodeCustomer().getCustomerElementAt(leadSelected).getCsal()));

int j = node.getCurrentElement().index();

IPublicCustomerComp.ICustomerElement custElm = wdContext.createCustomerElement();

custElm.setCname(node.getElementAt(j).getAttributeValue("custName").toString());

custElm.setCno(node.getElementAt(j).getAttributeValue("custNo").toString());

custElm.setCsal(Double.parseDouble(node.getElementAt(j).getAttributeValue("custSal").toString()));

wdContext.nodeCustomer().addElement(custElm);

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459...

Regards,

Mithu

Former Member
0 Kudos

Hi Abhijeet,

I think there is no such functionality available. All you need to do it programatically.

Thanks n Regards,

Jhansi Miryala