cancel
Showing results for 
Search instead for 
Did you mean: 

Copy data from Model node to another model node

former_member300754
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you for some good advise.

It has helped me a lot

/KV

Former Member
0 Kudos

Hi

You can achieve by using this API.

WDCopyService.copyElements(Source node,TargetNode);

Note:Both Nodes have same structure and cardinality

former_member300754
Participant
0 Kudos

Thanks Pravesh Verma and Tulasi Palnati.

I'll try as your advise.

: )