cancel
Showing results for 
Search instead for 
Did you mean: 

Copy a node to an other node

Former Member
0 Kudos

Hi everybody,

how can i copy a node with a subnode to another node with also a subnode:

Copy:

-- NodeA

-


NodeA1

-


attr1

To:

-NodeB

-


NodeB1

-


attr1

regards,

Sid

Edited by: Sid on Oct 20, 2009 6:47 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I use the copyCorresponding method of the WDCopyService class

[http://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/progmodel/api/WDCopyService.html|http://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/progmodel/api/WDCopyService.html]

Former Member
0 Kudos

Hi Jennifer,

i just try it with WDCopyService.copyElements(NodeA, NodeB) and also with WDCopyService.copySubtree(NodeA, NodeB). But in both cases the subnode Node: NodeB1 was not filled.

regards,

Sid

Former Member
0 Kudos

Did you try copyCorresponding?

Former Member
0 Kudos

yes i do, but without success

Former Member
0 Kudos

First, make sure the data classes of the elements you are trying to copy are identical in source and target node. In fact, the nodes themselves should be identical.

Next, make sure the objects you are trying to copy from/to are elements, not nodes. I could never make the methods copyElements and copySubtree work properly for me, but copyCorresponding works fine. Note that the method detail of the class states that object types other than IWDNodeElement or ICMIGenericModelClass are ignored, and will not necessarily identify the error.

If this doesn't work and you do get an error, please post it.

Answers (0)