Master Agreement Validate Script

Dear Team,
Do we have any method that can be used in Master Agreement Validate Script  to capture the action, once Delete document button is hit in Master Agreement.
Thanks,
Rajesh

Hello Rajesh,
We had a similar request in the past and my investigations revealed that there is only a limited use of this:
1. Yes, you can capture the 'delete' action in MA using: doc.getFieldMetadata("DELETED_BY").get(doc)
2. The 'problem': capture action takes place in ESO core, meaning that:
2.1 - Not possible to apply further validations and raise an error message (error msg is bypassed and a generic one displayed)
2.2 - Possible to use only for sending notifications, updating other documents, etc (any action that will not throw an exception ... PS: use try-catch)
Regards,
Bogdan Toma

Similar Messages

  • Script for setting Inco-terms in Master Agreement Setup

    Hi All,
    We have a requirement to create a follow-on child Master Agreement from a Parent MA. So we are writting a toolbar script to craete this follow-on Master Agreement. The problem we are facing is , we are not able to populate inco-terms (delivery terms) from the setup of Parent to Child Master Agreement.
    Although Master Agreement Setup has APIs but it seems there is no method which can allow us to get and set the values of inco-term in the collection (DEL_TERM_COLLN ) which is present in the setup of Master Agreement.
    Can you please throw some light on this issue, if it would be possible to set incoterms values in Master Agreement Setup.
    Thanks in Advance!
    Regards,

    Hello,
    If the IAPI doesnu2019t have the getter and setter, I would suggest raising a OSS message with SAP.
    Regards,
    Vikram

  • Script:How to access Master Agreement collaborators

    Hi
    I am trying to catch 1st collaborator name from "master agreement collaborator list" using Java Beanshell. I am using the below mentioned code:
    agreementBean = doc.getRootParentIBean();
    contractHome=IBeanHomeLocator.lookup(session,ContractIBeanHomeIfc.sHOME_NAME);  // get hold of current master agmt
    CollaboratorCollection = agreementBean.getCollaborators();          // to get all collaborators assigned to a master agreement
    collectionsize = CollaboratorCollection.size();
    if(collectionsize >0){
    Collectionbean= CollaboratorCollection.get(0)                        // Set pointer to 1st collaborator
    DisplayName= Collectionbean.getDisplayName();                 // Get name of 1st collaborator
    I am facing error with DisplayName. is "getDIsplayName" the correct method to fetch name of the first collaborator? Where can I get  list of methods for collaborator variable?
    Regards
    Mudit Saini

    Hi Devesh
    Thanks for your reply. You are right
    . contractHome=IBeanHomeLocator.lookup(session,ContractIBeanHomeIfc.sHOME_NAME) was not working properly so I removed it and instead I used  agreementBean = doc.getRootParentIBean() and the script is now working fine.
    Now I am able to get the name of the first collaborator from master agreement. Next step for me is to compare this name with user account name  and for the same I am using the below mentioned code:
    import com.frictionless.api.usermgmt.masterdata.UserAccountIBeanIfc;
    import com.frictionless.api.ibean.OrderedSubordinateCollectionIfc;
    import com.frictionless.api.contracts.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import com.frictionless.api.contracts.ContractIBeanIfc;
    import com.frictionless.api.ibean.OrderedSubordinateCollectionIfc;
    agreementBean = doc.getRootParentIBean();
    CollaboratorCollection = agreementBean.getCollaborators();
    collectionsize = CollaboratorCollection.size();
    if(collectionsize >0)
    Collectionbean= CollaboratorCollection.get(0);
    CollectionName= Collectionbean.getDisplayName();
    UserHome=IBeanHomeLocator.lookup(session, com.frictionless.api.usermgmt.masterdata.UserAccountIBeanIfc.sHOME_NAME); // to get access to user account bean
    UserBean=UserHome.find(CollectionName); // to find collaborator name in user account
    UserName= UserBean.getDisplayName();
    Now the problem here is it seems IBeanHomeLocator.lookup(session, com.frictionless.api.usermgmt.masterdata.UserAccountIBeanIfc.sHOME_NAME)  doesn't work with user account bean.I am getting the following error:
    Sourced file: inline evaluation of: ``import com.frictionless.api.usermgmt.masterdata.UserAccountIBeanIfc; import com. . . . '' : No static field or inner class: sHOME_NAME of interface com.frictionless.api.usermgmt.masterdata.UserAccountIBeanIfc
    Is there any other method to get access to user account bean?
    Regards
    Mudit Saini
    Edited by: Mudit_UCB on May 13, 2011 8:15 AM
    Edited by: Mudit_UCB on May 13, 2011 8:16 AM
    Edited by: Mudit_UCB on May 13, 2011 8:21 AM

  • Copy line items from Master Agreement to SubAgreement

    Dear all,
    As a requirement, we need to create a dummy line item at master agreement and subagreement level to be able to publish them to ERP without need
    to complete line items (they are completed in ERP via a development).
    We have created master agreement templates with a dummy line item but at subagreement level, templates are not available.
    What we are trying to develop is a script on post_create at agreement level to copy line items from Master Agreement to SubAgreement. We are able to get Master Agreement line items and copy them to the SubAgreement, but the subagreement is not created. This is the code we are using:
    import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeIfc;
    import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanIfc;
    import com.sap.odp.api.doccommon.masterdata.ValueListTypeIBeanHomeIfc;
    import com.sap.odp.api.doccommon.masterdata.ValueListTypeIBeanIfc;
    import com.sap.eso.api.contracts.ContractIBeanHomeIfc;
    Mst_agreementBean = doc.getParentIBean();
    lineItemCollectionSub = doc.getLineItems();
    lineItemCollection = Mst_agreementBean.getLineItems();
    collectionsize = lineItemCollection.size();
    colln = Mst_agreementBean.getCollectionMetadata("MA_LINEITEMS").get(Mst_agreementBean);
    colln2 = doc.getCollectionMetadata("MA_LINEITEMS").get(doc)
    newProject = Mst_agreementBean.getIBeanHomeIfc().createFromAnother(Mst_agreementBean);
    newMember = colln.get(1);
    //  Get Values Line Item
    assCat = newMember.getAcctAssignCategory();
    actLimP         = newMember.getActualLimitPercent();
    delAdCity       = newMember.getDeliveryAddressCity();
    delAdCount    = newMember.getDeliveryAddressCountryRef();
    delAdDist       = newMember.getDeliveryAddressDistrict();
    //... (all fields included in the script)
    // Create Line
    newMember2 = newMember;
    AgreementHome = IBeanHomeLocator.lookup(session, doc.getObjectReference());
    AgreementHome.upgradeToEdit(doc);
    // Set Values
    newMember2.setAcctAssignCategory(assCat);
    newMember2.setActualLimitPercent(actLimP);
    newMember2.setDeliveryAddressCity(delAdCity);
    newMember2.setDeliveryAddressCountryRef(delAdCount);
    newMember2.setDeliveryAddressDistrict(delAdDist);
    //... (all fields included in the script)
    try{
    colln2.add(newMember2);
    AgreementHome.save(doc);
    AgreementHome.downgradeToView(doc);
    collectionbean = colln2.get(0);
    logInfo("Value of  collectionbeanSub " + collectionbean );
    }catch (ApplicationException e){
    logInfo("Error " + e.getClass() + ". " + e.getMessage());
    When we try to create an Agreement under a Master Agreement (clicking Add on Agreement tab), following error message is shown related to the line in blue:
    Facility=local4;sessionid=4e73bb8e73304d6284816f93f4e04522a7c387b; tenantid=#tenant.ecb#;username=LUGUELL; exception=Sourced file: inline evaluation of: ``// **   import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeI ... '' : Method Invocation AgreementHome.save : at Line: 164 : in file: inline evaluation of: ``// **    import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeI ... '' : AgreementHome .save ( doc )
    Target exception: java.lang.NullPointerException: while trying to invoke the method com.sap.eso.contracts.ContractTypeBo.getVendorVisible()
    of a null object returned from com.sap.eso.contracts.ContractCommonBo.getTypeBo()
    ;stacktrace=Sourced file: inline evaluation of: ``// *JLA*    import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeI ... '' : Method Invocation AgreementHome.save : at Line: 164 : in file: inline evaluation of: ``// *JLA*    import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeI ... '' : AgreementHome .save ( doc )
    Target exception: java.lang.NullPointerException: while trying to invoke the method com.sap.eso.contracts.ContractTypeBo.getVendorVisible()
    of a null object returned from com.sap.eso.contracts.ContractCommonBo.getTypeBo()
    Any ideas what is causing the error? What are we missing on our code to copy line items?
    Many thanks,
    Marc Romagosa
    Message was edited by: Marc Romagosa de Riba

    We managed to create a line item at VALIDATE script, but not at POST_CREATE. Either it is a bug or it is not possible at POST_CREATE script.

  • CLM Company-Organization Unit in Master Agreement

    Hi guys
    In a CLM Master Agreement, after I select a company, I am able to select any organizational unit, even if it does not belong to that company. The system does not issue any error message. Is it standard behavior?
    Shouldnt the system validate that only the organizational units which are belonging to a particular company be displayed?
    Thanks and regards
    Ajay

    Hi,
    It looks it is standard behaviour.
    We have put in script to validate and added a query to query group so that user can search ORG UNIT by company code.
    //........................Gets company code
    getChildFieldByFieldId(parentFieldId,childFieldId){
            value=doc.getExtensionField(parentFieldId).get();
         if(hasValue(value)){
              parenthome=IBeanHomeLocator.lookup(session,value);
              parentbean=parenthome.find(value);
              childField=parentbean.getExtensionField(childFieldId).get();
              return childField;
         return null;
    validateCompanyCodes(parentfieldId,childFieldId){
            flag=false;
         maCompanyCode=doc.getExtensionField("SAPCCODE").get();
            companyCode=getChildFieldByFieldId(parentfieldId,childFieldId);
         if(companyCode==null @or !hasValue(maCompanyCode)){
              flag=false;
         }else if(maCompanyCode.equals(companyCode)){
              flag=true;
         return flag;
    purchasingOrgCompanyCodeMatch=validateCompanyCodes("SAPPORG","sapccode");

  • Disabling the default search when searching for master Agreements

    Hello Experts
    I am relatively new to SAP e sourcing ,we are working on 5.1 system.
    We have a query , Contract management->Agreements->Search master agreements and Sub agreements.
    This query takes a lot of time for execution.
    When user selects this option , it runs this query and then displays a screen with all the filters and search results at the bottom.
    I want to ensure that this query is not run by default, so that when user selects this option , the page only displays the selection criteria , users can specify the filter values and hit on search.
    Can anyone please help me on how can we disable the default execution of query everytime "Search master agreements and Sub agreements " is selected from the dropdown.
    is there any option within the query itself or do we need any script for doing this.
    Regards
    Vikas

    Hello Vikas,
    This should be the general approach.
    1) Write a new query that has the functionality you desire. In your case you can duplicate the existing query and make one of the filters mandatory. This will ensure that the query does not get executed by default. Save this new query in the system.
    2) Identify the corresponding query group. In your case it is FCI-ContractBuyList.
    3) In this query group, find the entry for 'Search Master Agreements and Agreements' query and check 'Remove Query from Selection List'.
    4)Add your new query in this query group and check the 'Include in SRM Navigation' checkbox. Click Save.
    Let us know if this works.
    Thanks
    Devesh

  • Workflow for Master Agreement (Publish to ERP)

    What is the best practice for approval workflow before publishing a master agreement from eSource to ECC?
    In the interest in keeping the source-of-truth within a single application we do not want to keep approval workflow of Outline Agreements in ECC as it is currently when moving the creation of the master agreement functionality to eSource.  There is no inherent workflow functionality for master agreements in eSource.  Are there customizations and/or best practices for having workflow of master agreements such that the Publish to ERP would not be possible until approval has been done within the eSource application?

    Hi,
    As you rightly said, Work flow support is not available in MA and more specifically before sending it to ERP
    Here are some options you may want to consider:
    - Try to use ACL/Security rights to control who can publish to ERP. For instance only the "document owner" can publish and the document owners are responsible. You can put a message or ask the publisher to enter some values on extension fields on who all approved this document.
    - Try using approval functionality in ERP if that works. that may be the simplest..
    The following options require heavy customization & scripting:
    Leverage workflow support from other docs
    - Tie an User defined business document (UDO that supports workflow) with MA. Provide a custom action, which will create a UDO biz doc instance and trigger a workflow behind the scenes.  MA will have a reference to UDO and vice versa. Users will approve the UDO.  In your Pre Publish to ERP script check for the approval conditions of UDO and work with that.
    - if MA is created from Projects try using project workflow for the business process..
    Good luck!
    Thanks, Baski

  • Multiple currencies in master agreement

    All,
    Any ideas on how a master agreement can handle multiple currencies?
    Even the subagreement carries over the master agreement currency and a script would not change it.
    Regards,
    Subhasini

    Hi Subhasini,
    Master agreement doesn't support multiple currencies in CLM till date. Only RFx does. You may have model your scenarios working around this limitation. One solution could be to use MA instead of subagreements and tie them with document links...
    Guess In newer releses (wave 8) contract heirarchies are supported, where you can have multiple MAs linked and each of them can have their own currencies.
    Thanks,
    Baski

  • Not Able To Delete Master Agreements/Sub Agreements

    Hello Everybody,
    I have to delete a Master Agreement or Sub Agreement. The Help sections says that in order to be able to delete a MA/SA the following conditions should be met :
    1) The current date should be greater than end date.
    2) The current date should be greater than the Retention Date
    3) The document should not be flagged as perpetual.
    My document meets all the above conditions but when I try to delete it, I get a pop-up saying that the 'Document could not be deleted. It has been restored to its previous version'. I checked the log and it didn't help much. The Error there was 'Unable to delete the document'.
    Now, here is the best part : I have a validation script that runs on a MA. If I make that script inactive, the document gets deleted. When I make it Active, I am not able to delete the document. The script, independently, runs without any error but seems to be generating exceptions here.
    I am not sure why the system behaves this way. Any help is appreciated.
    Thanks In Advance,
    Devesh

    Erik,
    Thanks for the reply.
    We have actually tried the approach you are suggesting before posting this thread. I wrote a similar logic to see whether the checkbox is checked and then delete it. But it was not of any help.
    The same problem occurs. But the moment I make the script inactive things work now.
    So, as of now, the problem is still there.
    Thanks
    Devesh

  • Master Agreements fields carry over to child Agreement.

    Hi,
    How can I carry over the fields set in the master agreement module to a child agreement?
    I believe I need to have a script definition on the creation of child agreement. but how can I get the reference to the master agreement fields? Any sample code?
    Also if not for script definition is there any other way out?
    Edited by: patsy lobo on Sep 22, 2008 7:35 PM
    Edited by: patsy lobo on Sep 22, 2008 7:36 PM

    HI,
    Adding to what Sudipta has said, you can also use the workbook technique for accomplishing these type of changes. That way you can achieve all hover text changes in one shot across all MA tabs.
    The 2 main tabs in the wokbook to be changed are: 'Localized Resource' and 'UI overrides' tab.
    As an example, suppose you want to add the following text for Master Agreement External Category field:
    "This field is a classification hierarchy to describe the products or services of the event and/or agreement."
    So in the Localized resource tab, fill out the following:
    BUNDLE: custom
    RESOURCE_ID: xxx     
    RESOURCE_KIND: APP_TEXT     
    DEFAULT_VALUE: This field is a classification hierarchy to describe the products or services of the event and/or agreement.
    Then refer the same attributes in the UI Overrides tab:
    UI_ID: contracts.agreement.ui.buyside.default
    FIELD: EXT_CAT
    ATTRIBUTE: Description
    VALUE: Same as Resource ID used in localized resource (xxx above)
    Hope this helps,
    Vikram Shukla

  • Unable to capture field values in Master agreement  Line Items

    I am trying to get the field values from master agreement line items page. I have written the following code to get the line item details which is working fine to capture part number and quantity->
    agreementBean = doc.getRootParentIBean();
    lineItemCollection = agreementBean.getLineItems();
    collectionsize = lineItemCollection.size();
    for(i=0;i<collectionsize;i++){
         collectionbean = lineItemCollection.get(i);
         partNum = ""+collectionbean.getPartNumber() ;
         Quantity = ""+collectionbean.getQuantity();     
         throw doc.createApplicationException(null,partNum + " , " + Quantity );
    Now, my problem is that I am unable to capture the following field item values in the master agreement > line items page.
    1. Price Unit
    2. Unit Price
    3. Product Category
    4. Plant
    Please help me to find the values.
    Thankx in Advance.
    Su
    Edited by: subrataindra on Aug 10, 2010 11:11 AM

    This will return the name of the plant.
    .getExtensionField("PLANT").get().getDisplayName(session);
    Check if this returns the product category
    collectionbean.getExtensionField("ITEM_CAT").get().getDisplayName();
    This will Return the Price
    collectionbean.getExtensionField("PRICE").get().getPrice();
    (return type :BigDecimal)
    This will return the currency
    collectionbean.getExtensionField("PRICE").get().getCurrency;
    (Return type:String)
    Similarly to retrieve other fields for which there are no standard functions, use .getExtensionField("Field ID")
    Hope this helps
    Regards,
    Immanuel

  • How to make extended field mandatory in Master Agreement

    Hello All,
    I am new to SAP CLM, and I have requirement where one extended field in master agreement needs to be made as mandatory field.
    I tried in extension definition but check box to make it required is disabled and I am unable to find other way to do it.
    Can some one help me and Please let me know how make extended fields mandatory in CLM.
    Regards,
    Prabhat

    Hi
    This could be achieved using Page Customization.Go to Setup-> User Interface-> Page Customization, open master agreement object (create new with UI ID:contracts.contract.ui.buyside.default if doesn't exist ) and add a new customization for extended field with Property set to Required.
    Regards
    Mudit Saini

  • How to change the standard query "Create a Master Agreement" by a custom one

    Hello Sourcing CLM experts,
    I would need to replace the standard query displayed when the user tries to create a Master Agreement by a custom query to filter the MA types according to some criteria:
    According to this post: Re: Create security profile for a document template in SAP Sourcing, I've tried to achieve it by doing the following steps:
    Create a new query as a copy of exsiting query FCI-ContractTypes
    Modify query group FCI-ContractTypesBP to include my custom query instead of the standard one to only list the MAType "Standard Master Agreement"
    Following you can see the change done into the query group FCI-ContractTypesBP:
    However, standard query has not been replaced and same set of MA Types are listed.
    Therefore, I would like to ask you:
    Is it possible to do this kind of modifications? If so, which query group need to be modified?
    If it is not possible, is there any other way to achieve that requirement?
    Thanks in advance for your time and support!
    Best regards,
    Isaac

    Hello again experts,
    If this query cannot be modified, is there any option to disable button below? Or at lease, to disable the query group to avoid the listing of MA Types when it is pressed?
    The reason is because we are going to set up the system in the way that only it will be possible to create Master Agreements from Template. However, if user keep on using that button he will be able to create MA from document types.
    Any ideas?
    Thanks again and best regards,
    Isaac

  • Can we hide filter in Search Master agreements standard top level query?

    Hi Experts, 
    I have a requirement to hide flter in standard Search Master Agreements top level query.  See below screen shot
    I have an idea how to delete filter in query but when i have added that query to top level navigation i don't have any idea.
    So i want to hide Business Unit & Region filter in Search Master Agreement query when it is in top level navigation.
    If anyone have idea please share with me how to hide.
    Thanks,
    Lava

    Hi Lava,
    It is not a filter but this a Standard field which is coming from the Master Agreement.
    So, you cannot hide or even delete any field.
    But if it is a custom field you can hide it by inactivating the respective field in Extension Defination.
    Please let me know if you need any assistance.
    Thanks,
    Raj.

  • How to get Payment Term description in a MAster Agreement

    Hi,
            I am able to get the PAYMENT TERMS for a Master Agreement
    code:
    payment_term_str= doc.getPayTermsRef() ;
    term_id = payment_term_str.getDisplayName() ;
    how I will get the Payment Terms Description ?
    Thanks in advance.
    Regards,
    Swastik

    import com.frictionless.api.common.types.TypeFactory;
    paymentHome=IBeanHomeLocator.lookup(session,doc.getPayTermsRef());
    paymentBean=paymentHome.find(doc.getPayTermsRef());
    resourceID=paymentBean.getDocumentDescriptionId();
    rRef=TypeFactory.createResourceReference(resourceID);
    paymentDescription=rRef.getValue(session);
    Hope this helps.
    Regards,
    Immanuel

Maybe you are looking for

  • ITunes deleted my songs from my HARD DRIVE!

    iTunes not only has deleted a few files from my library, but it ALSO deleted songs off my hard drive! I thought, "Well, maybe they just got moved around somehow." But, I thought about how much I go into my iTunes folder and then it dawned on me that

  • Apple TV not playing purchased content. iTunes account Issue?

    Like many others, I'm having issues getting Apple TV to play purchased content for a specific iTunes account. After hitting the play button, the movie or TV show thinks about it then reverts back to the information page.  This has been happening for

  • I downloaded the Premiere Pro trial and there is no sound.

    My clip worked fine on Premiere Pro cs6 (I have a copy of premiere pro cs6 on university campus) but now I've downloaded the trial on my laptop I cant get the sound to work. Please help!

  • PO against reservation

    hi all, i got few reservations in reservation list automatically through plant maintenance order.... but the stock is nt available of those materials.... how ths communication goes to purchaser that he has to procure the material..... is there ne way

  • Options to create an IWorklistContext

    I am using the RemoteWorklistClient and I am trying to create a valid IWorklistContext and it appears that I have two options. First, I could supply a username/password combo and second, I can pass on an HttpRequest object. Neither of these seem to b