Skip to Content

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

Leavers and joiners policy ideas?

Hi,

I'm looking for slick ideas around managing a leavers and joiners policy so that if John Smith leaves I can replace him across all Projects, Contracts and RFx with Fred Bloggs. The key here is ensuring the audits remain in place so that we can track who actually makes the changes.

I've tried several tests but can't find a way that updates all records with the new details. Maybe I'm missing something.

The only other route is to export all records, replace the Owner or collaborator names and reload. But this is quite a task once a week for 1000 active users.

Ideas, solutions appreciated.

J

Former Member
Former Member replied

Hi Jethro - Following up on my previous reply, below is the script I developed for my prototype.

Regards,

Rob


// This script will update the owner of the business document
// where the current owner is the "from owner"
import com.sap.eso.api.projects.*;

fromOwner = doc.getExtensionField("FROM_USER").get();
toOwner = doc.getExtensionField("TO_USER").get();

// Find the projects for the from owner
projHome = IBeanHomeLocator.lookup(session, ProjectIBeanHomeIfc.sHOME_NAME);
projList = projHome.findWhere("DOC_OWNER_USER_OBJECT_ID = " + fromOwner.getObjectId().toString());

// Get the audit messages collection
auditMsgs = doc.getExtensionCollection("AUDIT_MSGS");

// Indicate how many projects were found
auditMsg = auditMsgs.create();
auditMsg.set("AUDIT_MSG", "Found " + projList.size() + " projects to update");
auditMsgs.add(auditMsg);

// Iterate over the projects and change the owner
if (projList != null)
{
    iter = projList.iterator();
    while (iter.hasNext())
    {
        // Work with the bean now
        projBean = iter.next();
        projHome.upgradeToEdit(projBean);

        // Now change the owner
        projBean.setDocumentOwnerUserReference(toOwner);

        // Finally, save
        projHome.save(projBean);

        // Add an audit message
        auditMsg = auditMsgs.create();
        auditMsg.set("AUDIT_MSG", "Updated project " + projBean.getDocumentId());
        auditMsgs.add(auditMsg);
    }
}

// Add logic below for additional object types (e.g., RFx, Auction, Master Agreements).

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