cancel
Showing results for 
Search instead for 
Did you mean: 

Payment terms description variable

Former Member
0 Kudos

I want to use a variable during contract generation to capture the agreement's payment terms description.  While there is already a common agreement variable for the payment terms with the token <%Agreement.PaymentTerms%>, I need the associated description.  Unfortunately, the description is not available in the attribute name list when creating a new variable.

Does anybody have any ideas as to how I can define a variable for the payment terms description?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Arlene,

I am very much agreed to the uday's comment that its not possible in the standard way.

But it can be achieved by using the following customization:

1) Create a extension field at the Agreement and hide it from the users.

2) Set the value of extension field from Payment terms description using the script on Agreement.

3) Create a new variable using extension field for Agreement in Variable library for contract generation.

Let me know for further clarifications.

Thanks,

Ankur Goyal

Former Member
0 Kudos

Thanks, Ankur.  I had a feeling that I would have to resort to that.  However, since I'm new to scripting, I'm not exactly sure what the script should be so I could use a little help with that.

I've created an extension field called PaytermsDesc for the Agreement.  I'm figuring that I want to set my script to trigger on field validation so that my extension field will get populated on a new document or when the user changes the payterms field.

I know that when the user selects a value from the object picker for the PAYTERMS field, the system does some kind of lookup to populate the displayed PAYTERMS_DESC field.  So how do I get the PAYTERMS_DESC value into my PaytermsDesc extension field?  I figure it is something like:

doc.getExtensionField("PaytermsDesc").set(doc.getPAYTERMS_DESC);

However, I don't think I can directly get the description value like this.  Can you please guide me on the syntax for getting the PAYTERMS_DESC value?

Former Member
0 Kudos

Hi Arlene,

Please find the below code to set the extension fiels 'ContractXRef' to the payment description selected in the payment terms object reference:

Code:

import com.sap.odp.api.doccommon.masterdata.PaymentTermIBeanHomeIfc;
import com.sap.odp.api.doccommon.masterdata.PaymentTermIBeanIfc;
import com.sap.eso.api.contracts.ContractIBeanIfc;


//get the paymentterms object reference
paymentRef=doc.getPayTermsRef();

//get the paymentBean details

paymentHomeBean=IBeanHomeLocator.lookup(session,PaymentTermIBeanHomeIfc.sHOME_NAME);
paymentBean=paymentHomeBean.find(paymentRef);

//to get the payment description from the payment terms masterdata
paymentdescription=paymentBean.getDocumentDescription();

//set the description in the extension field

doc.getExtensionField("ContractXRef").set(paymentdescription);

You can perform this code on validate script of the Master agreement.

Please let me know for further clarifications.

Thanks,

Ankur Goyal

Former Member
0 Kudos

Ankur,

Thank you so much for providing the script.  It worked perfectly!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Arlene ,

There is no way you can create tokens , you can probably raise a OSS and depending on your requirement you might get a standard token in future releases of Sourcing.

Thanks

Uday