cancel
Showing results for 
Search instead for 
Did you mean: 

setting default Payment Term while creating MA/AGR

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Krish.

There is one modification in the code.

Please replace iapi with this , this is to get home bean.

com.sap.odp.api.doccommon.masterdata.PaymentTermIBeanHomeIfc

Please try and let me know if you face any further issues.

Regards,

Geetika

Former Member
0 Kudos

Give like this: payTermHome=IBeanHomeLocator.lookup(session,com.sap.odp.api.doccommon.masterdata.PaymentTermIBeanHomeIfc.sHome_NAME);

Former Member
0 Kudos

H Geetika,

Thank you for your post.

I have tried the new code as well, unfortunately did not work.

Getting same error.

I have taken these classes from IAPI to avoid typo, but no luck.

Did it work for you ?

Thanks

Krish