cancel
Showing results for 
Search instead for 
Did you mean: 

how to load supplier from agreement on Forms

Former Member
0 Kudos

Hi Experts,

We are creating a Form and selecting a Master Agreement from the Header tab.  When the MA is created, we want to automatically populate the Supplier from the MA into the Suppliers tab.

We tried the following code but could not get the Supplier loaded.

vendExtId = IBeanHomeLocator.lookup(session,doc.getVendorRef()).find(doc.getVendorRef()).getExternalId();

vendorBean= (VendorIBeanIfc) IBeanHomeLocator.lookup(session, com.sap.odp.api.doccommon.masterdata.VendorIBeanHomeIfc.sHOME_NAME).findByExternalId(vendExtId);

if (hasValue(vendorBean)){

rColCol=doc.getCollnVendors();

ven = rColCol.create();

ven.setDisplayName(vendorBean.getDisplayName());

rColCol.add(ven);

Please see attached screen print for what we are tryign to see.

Thank you!

Phil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Phil,

If I understood correct, you have created a UDO form and pointing it to an MA.

And you would like to auto populate Vendor info from MA to this from. For this, you can try the following code:

I believe, here MA is an extension field.

import com.sap.odp.api.doccommon.userdefined.UserDefinedVendorSubIbeanIfc;

import com.sap.odp.api.doccommon.userfefined.UserDefinedVendorSubIbeanImpl;

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

maId = doc.getExtensionField(" Put Extension Name here").get().getDsiplayName().toString();

maBean = (ContractIBeanIfc)maHome.findByUniqueDocName(maId);

vendorName = maBean.getVendorRef();

vendorContact = maBean.getContactRef();

if(hasValue(vendorName) && hasValue(vendorContact))

{

vendColln = doc.getCollnVendors();

collnRow = vendColln.create();

collnRow.setVendorObjRef(vendorName);

collnRwo.setContactObjRef(vendorContact);

vendColln.add(collnRow);

}

Hope this would help you.

Thanks

Krish

Answers (0)