Skip to Content
avatar image
Former Member

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 (33.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Oct 30, 2015 at 08:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded