cancel
Showing results for 
Search instead for 
Did you mean: 

Need to mass delete master agreements and contract documents in SAP E sourcing.

Former Member
0 Kudos
636

Hi Everybody,

I am new to SAP CLM, We have requirement of deleting the master agreement and contract documents.

We have huge number of master agreements and contract documents stored in excel.

We need to mass delete it from the CLM system.

Any help is appreciated

Thanks

Vaibhav Dhoke

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Following solution is implemented successfully.

I have written an explicitly called script which will be executed under the scheduled job.

Step 1: We need to create two boolean extensions suppose X, Y for Master agreement and contract document respectively which will act as a flag for MA and CD to be deleted. Those extensions are marked as checked once when I upload the CSV file in system.

Step 2: Table FCI_SYS_DYN_CLASSES stores the table of extensions for the classes present. We need to find the extension table sDynTableName which stores the extensions of Master agreement by using master agreement class id i.e 1004

Query would be like SELECT TABLE_NAME FROM FCI_SYS_DYN_CLASSES WHERE ASSOC_CLASSID=1004 AND COLLECTION_NAME IS NULL

Step 3: Once we have the sDynTableName dynamic extension table got from step 2, we will have to look for those master agreements where X is checked by using the query like SELECT T1.UNIQUE_DOC_NAME FROM FCI_CONTRACT T1, " + sDynTableName + " T2 WHERE T2.PARENT_OBJECT_ID = T1.OBJECTID AND X = 1

Step 4: Result of step 3 query would be the collection of master agreements,

We will iterate over this collection and get the reference contract documents (suppose CDRef)for which Y is checked,

If we want to delete the contract document, following is the piece of code used.

contractDocumentHome.upgradeToEdit(CDRef);

contractDocumentHome.delete(CDRef);

contractDocumentHome.downgradeToView(CDRef);

If we want to delete the master agreement directly.

MasterAgreementHome.upgradeToEdit(MARef);

MasterAgreementHome.delete(MARef)

MasterAgreementHome.save(MARef);

where MARef the master agreement reference where X is checked.

Above methods are used as per your requirement(conditions) of deleting the master agreement and contract document.

contractDocumentHome and MasterAgreementHome are the home bean reference of contract document and master agreement respectively which can be obtained by using the lookup method of IBeanHomeLocator as below

MasterAgreementHome = IBeanHomeLocator.lookup(session, com.sap.eso.api.contracts.ContractIBeanHomeIfc.sHOME_NAME);

contractDocumentHome = IBeanHomeLocator.lookup(session,com.sap.eso.api.doccommon.doc.contract.ContractDocumentIBeanHomeIfc.sHOME_NAME);

P.S : Proper exception handling should be done.

Answers (0)