This blog post is to suggest one of the best solutions to copy a nodes data to another node provided both the nodes have same structures(i.e the context attributes are the same).
Consider the scenario to be in case of a table ui on a webdynpro screen where in the suggested table may have more than 5 fields.Therefore in order to make the ui more appeasing we keep upto three columns in the table followed by two more columns of Add/Edit and Delete.This table UI is bound to context Node-CTX_VN_Node1 of collection and selection cardinality 0..n.
When clicked on Add/Edit for a particular row ,a popup opens consisting of the rest of the fields in a flow layout manner with two buttons at the end namely Done and Cancel.In the pop up window Here the fields will be bound to a different node namely -CTX_VN_Node2 of collection and selection cardinality 1..1 and 0..1 respectively.
Though different nodes ,the context attributes of both CTX_VN_Node1 and CTX_VN_Node2 are the same.
On the click of Done instead of setting the values of each of the attributes of CTX_VN_Node2 to the lead selection index of CTX_VN_Node1,it is relevantly easy to use WDCopyService where in
where in we can specify in the source as CTX_VN_Node2 and Target as CTX_VN_Node 1 at the lead selection.
For further functions of WDCopyService,please refer the below link: