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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning persistent objects

Former Member
0 Kudos

hi everybody,

im trying to clone objects which are bound to the sap persistency service. i've implemented the interface IF_OS_CLONE in my persistent class and it seems to work correctly, i can clone my objects. The actual problem is that they are not written into the database after i do a commit.


client2 ?= client->if_os_clone~clone( ).

COMMIT WORK AND WAIT.

Do i have to call another method to do this or implement an additional interface?

thanks for your help.

1 REPLY 1

naimesh_patel
Active Contributor
0 Kudos

I have never tried the cloning of persistent object before. But it seems to be tedious task.

Actually, when we call the COMMIT WORK system internal calls the SAVE method in the Base Agent Class (ZCB* Class) through the Agent class object (Object of ZCA*). It loops through the attribute OBJECT_INFO. This table contains the reference to the Persistent class (ZCL_persistent).

Now when we do the clone for persistent class ZCL_persistent in method IF_OS_CLONE~CLONE using the


  SYSTEM-CALL OBJMGR CLONE me TO result.

system will generate a new persistent object for us. But it doesn't link the cloned persistent object to the Agent class in the atrribute OBJECT_INFO. It is kind of dangling persistent object without any agent class. So, any change made to the cloned persistent object will not take place.

I am trying to find out a way to put the cloned object to the agent's attribute OBJECT_INFO.

Regards,

Naimesh Patel