on 04-08-2009 10:43 AM
Hi all,
My question is how can i copy data from model node to another model node? In ABAP, i would use the statement as below
Append lines of itab1 to itab2.
In this case if i don't want to FOR the node, does it have another way to do this?
Thank you in advance : )
Peerasit
Hi ,
You can use copy corresponding API.
1) You can use the CopyElements method of WDCopyService, which will copy elements of one node to another node.
Pre requisite:
1) Both the node Structure including the attributes should be same.
2) Either both of the target and Source node should be Model node OR both should be Value node.
2) You can use the copyCorresponding method of WDCopyService. Read the java Doc for copyCorresponding:
* The Web Dynpro equivalent for the well know abap feature
* "MOVE_CORRESPONDING". It intentionally has been renamed because the term
* "move", although always being used in Cobol and ABAP, is not quite correct
* and unusual in Java.
* <p>
* The method inspects all attributes of <code>source</code>, searches a
* compatible attribute in <code>target</code> and copies the value if it
* finds one. Values are considered compatible if their Java class matches:
* <ul>
* <li> All numeric classes (Byte, Short, Integer, Long, Float, Double,
* BigInteger and BigDecimal) and primitives (byte, short, int, long,
* float, double) are compatible.
* <li> Boolean class and primitive are compatible.
* <li> Character (class) and char (primitive) are compatible.
* <li> Otherwise source and target attribute must be based on the same class.
* </ul>
* <p>
* Currently, both <code>source</code> and <code>target</code> may be either
* an {@link IWDNodeElement} or an {@link com.sap.tc.cmi.model.ICMIGenericModelClass}.
* If any object is of another class, it is simply ignored. These both classes
* have been chosen, because they can tell about their structure at run time
* without the need of Java reflection.
* <p>
I hope this solves your issue.
Thanks and Regards,
Pravesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for some good advise.
It has helped me a lot
/KV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can achieve by using this API.
WDCopyService.copyElements(Source node,TargetNode);
Note:Both Nodes have same structure and cardinality
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.