Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to load supplier from agreement on Forms

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

screen print.gif (33203 B)
Tags:
Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question