Programme SAP REW_RELATIONS_CORRECTION - Program for Correcting Object Links

Activities
INFORMATION:
The principle procedure for the report is as follows:
The processing is carried out by table in packages of up to 1000 datarecords.
In the ArchiveLink area (customizable quantity of database tables), theaccount holder for the individual contract accounts is read, and theobject identifier is saved as a compound string from the contractaccount and the account holder.
In the object link area (table SRRELROLES) the procedure is a littlemore complicated. After selecting the contract accounts and reading theaccount holder, all contracts whose object keys already consist of thecompound string from the contract account and account holder are firstselected for the "incorrect entries" (object key only consists of thecontract account ID) (search for duplicates). When correcting the objectlinks you must differentiate between three cases:
1.) Entries without duplicates
2.) Entries with duplicates, but without related links
3.) Entries with duplicates and related links.
In the first case, the object key is simply saved as a compound stringfrom contract account and account holder.
In the second case, the problem is solved by deleting the "incorrect"entry.
In the third case, the related links for the "incorrect" entry mustfirst be read. These links are then attached to the "correct" entry, andits object key and roles - the GUID is modified. Finally, the"incorrect" entry is deleted.