Skip to Content

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

Add New Collaborator in all Master Agreements


I am new to SAP sourcing

I have a requirement to add a new Collaborator in all Master Agreements. My problem is now I have written a script that works perfectly when I run it for a single Master Agreement. But when I expand my list and add all the master agreements, I get a problem that some of the already saved Master agreements have errors that have arisen from:

1. For Example: a new "required" field is added to the Master Agreement. As a result, the script cannot go add the required field on the old Master      Agreements.

Different Master Agreements have different errors once opened.

Please assist me by helping me to be able to continue adding my collaborator without having problems with the errors or My script should skip all those cannot be saved.

Below is my script

collab = doc.getExtensionField("Add_Collaborator").get();


masterHome = IBeanHomeLocator.lookup(session, ContractIBeanHomeIfc.sHOME_NAME);

contractList = masterHome.findAll();

nameHome = IBeanHomeLocator.lookup(session,UserDefinedMasterData1IBeanHomeIfc.sHOME_NAME);

n = doc.getExtensionField("Add_Collaborator").get();

if (contractList != null)

    iter = contractList.iterator();


   while (iter.hasNext())



      member =;







      newMember.setApprovalRule(new CollaboratorApprovalRuleType(new Integer(0)));


     //Get display name





   //add the collection member to the collection


     //save the document




Former Member
Former Member replied


It would be a lot easier and more controllable to handle this via Excel Workbook, rather than scripting.

You will need:

  • Extract all MA IDs from the system (via some report)
  • Create an xls file with template:
**MA Document ID****either username (for user collab) or External ID (for group collab)**
  • Populate the template with document IDs and values as explained
  • Import excel file via Setup -> Import Data -> Master Agreement

This procedure will result in processing ALL the MAs. The result will be a trace file with:

  • List of processed MAs
  • List of failed MAs (and error details)

If you really want to use scripting than simply use:


//save the document

try {


} catch (Exception e) {

     //maybe log something here.



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