Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Copy or Clone a Class

Former Member
0 Kudos

I am trying something out with the Prototype design pattern, which involves cloning one object from another. In C++ you have copy constructors and in Java a Clone method that do the basic cloning work. I am fairly sure I don't see an equivalent built-in feature in ABAP Objects. Is anyone aware of a good template or example for writing a cloning method? (Note: some if the interfaces in the ixml library, for example, if_ixml_stream, have a clone method, but I can't find any implementing classes.)


Former Member
0 Kudos


I've find interface:


The implementation is CL_OS_STATE.

In method "IF_OS_CLONE~CLONE" there's a system call:

SYSTEM-CALL OBJMGR CLONE <instance> TO <clone>.

where instance is instance clonnable and clone is the result.

ABAP Object don't support general class OBECT where you find clone method.


Former Member
0 Kudos

There is a buit in feature of CLONE in ABAP Objects. See example of clone methods in UserCompany object in transaction BAPI. You can also see examples of clone methods in Business Object USER