on 2015 Oct 08 12:55 PM
Hi Sourcing Experts,
I would like to set a default Payment Term through scripting while creating MA/AGR every time.
Can you please guide me how to accomplish this.
Thanks
Krish
Request clarification before answering.
HI krish,
You can write Document Lifecycle Event script on Validate event on MA Object.
Sample code:
payTermHome=IBeanHomeLocator.lookup(session,com.sap.odp.api.doccommon.masterdata.PaymentTermIBeanIfc.sHome_NAME); paymentTermBean=payTermHome.findByExternalId("external id of payment term"); paymentTermRef=paymentTermBean.getLocalizedObjectReference();
doc.setPayTermsRef(paymentTermRef);
Please try this code replacing external id of payment term.
Let me know if it works.
Regards,
Geetika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Geetika,
Thank you for your post.
I tried to implement your suggestion, unfortunately it did not work.
I am getting error msg like "findByExternalId() method is not available".
I did not find this method in PayTerm IAPI classes as well.
Earlier I tried with all finder methods to give a trial but did not work.
Thanks
Krish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.