Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Copy data from Model node to another model node

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 : )



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}.
   * 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,


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question