Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
4,669

Hello,

i came across the requirement to copy archive link connections from one object ot another. I would like to share the approach of a possible solution with the community.

Archive Link Connections are stored in the table toav(n) where n={1,2,3}.

What you require to read an archive link connection is the objecttype and the object_id. Tipicly the object id is a business object key and object type is a sap business object.

What steps need to be done to copy the Archive Link connections.

0) Customizing for Document Types or other criterias

1) Get the connections of the source object

2) Copy the existing connections to the target object

3) Set the copied connections entries

Now i would like to describe a possible implementation & the required sap functionality step by step.

0) Customizing for Document Types or other criterias

In this step, you could define a customizing table that controls what entries should be copied. I won't go into detail here, as i assume, that creating a customizing table is very common and not that interesting.

1) Get the connections of the source object

The "hard" part in this step is to identify the proper object. Usually objecttype is the sap business object z.b. BUSnnnn and the objectid is the key of the business object. So the interesting part is the following function module:  ARCHIV_GET_CONNECTIONS. To call this function module, provide the objecttype and the objectkey. The present connections are provided in the parameter in connections.


2) Copy the exsiting connections to the target object

This step is quite simple. Loop over the connections readed in step one and change sap_object and object_id in the connection entry structure to the target objects objecttype and target objectid


3) Set the copied connections entries

This step is also quite simple. Loop over the connections with the target object type and id and call the following function module:  ARCHIV_CONNECTION_INSERT. You could also use this function module: ARCHIV_CONNECTIONTABLE_INSERT - This function module basicly does the same as loop and ARCHIV_CONNECTION_INSERT.


So that it. By completing these steps, you should have been able to copy existing connections from a source object to a target object.


A wrapper around the four steps could look like this (Error Handling not included )

call method copy_connections(

exporting

iv_source_objcettype =

iv_source_objectid =

iv_target_objecttype =

iv_target_objectid =

)

I wish everyone a nice day.

Kind regards,

Michael

1 Comment
Labels in this area